Standard Implementation of TarantoolContainer
This page describes the standard implementation of the TarantoolContainer interface.
Class Diagram
GenericContainer SELF // some methods Tarantool3Container Tarantool3Container(DockerImageName dockerImageName, String node) withMigrationsPath(Path): Tarantool3Container withEtcdPrefix(String): Tarantool3Container stop(): void stopWithSafeMount(): void mappedAddress(): InetSocketAddress internalAddress(): InetSocketAddress withEtcdAddresses(HttpHost[]): Tarantool3Container withConfigPath(Path): Tarantool3Container node(): String start(): void «interface» TarantoolContainer SELF DEFAULT_TARANTOOL_PORT: int DEFAULT_DATA_DIR: Path restart(long, TimeUnit): void withMigrationsPath(Path): TarantoolContainer<SELF> internalAddress(): InetSocketAddress stopWithSafeMount(): void withConfigPath(Path): TarantoolContainer<SELF> mappedAddress(): InetSocketAddress node(): String GenericContainer SELF // some methods Tarantool3Container Tarantool3Container(DockerImageName dockerImageName, String node) withMigrationsPath(Path): Tarantool3Container withEtcdPrefix(String): Tarantool3Container stop(): void stopWithSafeMount(): void mappedAddress(): InetSocketAddress internalAddress(): InetSocketAddress withEtcdAddresses(HttpHost[]): Tarantool3Container withConfigPath(Path): Tarantool3Container node(): String start(): void «interface» TarantoolContainer SELF DEFAULT_TARANTOOL_PORT: int DEFAULT_DATA_DIR: Path restart(long, TimeUnit): void withMigrationsPath(Path): TarantoolContainer<SELF> internalAddress(): InetSocketAddress stopWithSafeMount(): void withConfigPath(Path): TarantoolContainer<SELF> mappedAddress(): InetSocketAddress node(): String
The Tarantool3Container class allows you to create a Tarantool 3.x container object that satisfies the contract of TarantoolContainer.
Implementation Description
Mounting Directories and Files Location
The implementation ensures the following behavior when configuring the container:
Tarantool3Container::start() Instance configured? yes No return Tarantool3Container.start() Create a temporary mount directory on the host mountDirectory Mount directories mountDirectory on the host and /data in the container Does the configuration file exist and is it a regular file? Yes No Mount the path to the configuration file pathToConfigFile to the file /data/configFileName in the container Notify the client via LOGGER::info(...) , that the configuration file was copied with specifying input and target files Notify the client via LOGGER::warn(...) , that the configuration file is not set, null, or does not exist Yes Does the path to the migration directory point to a regular file? Notify the client via LOGGER::warn(...) , that a path to a regular file was passed Yes Does the path to the migration directory null? No Notify the client via LOGGER::warn(...) , that the path to the migration directory does not exist or is null Mount the migration directory migrationsDir to the directory /data/migrationsDirName in the container Notify the client via LOGGER::info(...) , that the migration directory was copied with specifying input and target directories Do etcd addresses were passed? Yes No Use configuration from etcd . Set addresses and prefixes via variables TT_CONFIG_ETCD_ENDPOINTS , TT_CONFIG_ETCD_PREFIX Use configuration specified in the configuration file. Set the path to the configuration file via the variable TT_CONFIG return Tarantool3Container::start() Tarantool3Container::start() Instance configured? yes No return Tarantool3Container.start() Create a temporary mount directory on the host mountDirectory Mount directories mountDirectory on the host and /data in the container Does the configuration file exist and is it a regular file? Yes No Mount the path to the configuration file pathToConfigFile to the file /data/configFileName in the container Notify the client via LOGGER::info(...) , that the configuration file was copied with specifying input and target files Notify the client via LOGGER::warn(...) , that the configuration file is not set, null, or does not exist Yes Does the path to the migration directory point to a regular file? Notify the client via LOGGER::warn(...) , that a path to a regular file was passed Yes Does the path to the migration directory null? No Notify the client via LOGGER::warn(...) , that the path to the migration directory does not exist or is null Mount the migration directory migrationsDir to the directory /data/migrationsDirName in the container Notify the client via LOGGER::info(...) , that the migration directory was copied with specifying input and target directories Do etcd addresses were passed? Yes No Use configuration from etcd . Set addresses and prefixes via variables TT_CONFIG_ETCD_ENDPOINTS , TT_CONFIG_ETCD_PREFIX Use configuration specified in the configuration file. Set the path to the configuration file via the variable TT_CONFIG return Tarantool3Container::start()
Ensuring Mounted Data Preservation
According to the TarantoolContainer contract, when calling the TarantoolContainer::stopWithSafeMount() method and then calling TarantoolContainer::start() again, the mounted data must be preserved. Tarantool3Container implements this mechanism as follows:
Mounted directories are deleted only when calling the Tarantool3Container::stop() method. Container configuration occurs only once during the first call to Tarantool3Container::start().
Port Binding
Port binding is not performed at the container configuration stage. Port binding is performed after the container starts Tarantool3Container::start().