Skip to content

Standard Implementation of TarantoolContainer

Standard Implementation of the TarantoolContainer Interface

This page describes the standard implementation of the TarantoolContainer interface.

Class Diagram

GenericContainerSELF// some methodsTarantool3ContainerTarantool3Container(DockerImageName dockerImageName, String node)withMigrationsPath(Path): Tarantool3ContainerwithEtcdPrefix(String): Tarantool3Containerstop(): voidstopWithSafeMount(): voidmappedAddress(): InetSocketAddressinternalAddress(): InetSocketAddresswithEtcdAddresses(HttpHost[]): Tarantool3ContainerwithConfigPath(Path): Tarantool3Containernode(): Stringstart(): void«interface»TarantoolContainerSELFDEFAULT_TARANTOOL_PORT: intDEFAULT_DATA_DIR: Pathrestart(long, TimeUnit): voidwithMigrationsPath(Path): TarantoolContainer<SELF>internalAddress(): InetSocketAddressstopWithSafeMount(): voidwithConfigPath(Path): TarantoolContainer<SELF>mappedAddress(): InetSocketAddressnode(): String
GenericContainerSELF// some methodsTarantool3ContainerTarantool3Container(DockerImageName dockerImageName, String node)withMigrationsPath(Path): Tarantool3ContainerwithEtcdPrefix(String): Tarantool3Containerstop(): voidstopWithSafeMount(): voidmappedAddress(): InetSocketAddressinternalAddress(): InetSocketAddresswithEtcdAddresses(HttpHost[]): Tarantool3ContainerwithConfigPath(Path): Tarantool3Containernode(): Stringstart(): void«interface»TarantoolContainerSELFDEFAULT_TARANTOOL_PORT: intDEFAULT_DATA_DIR: Pathrestart(long, TimeUnit): voidwithMigrationsPath(Path): TarantoolContainer<SELF>internalAddress(): InetSocketAddressstopWithSafeMount(): voidwithConfigPath(Path): TarantoolContainer<SELF>mappedAddress(): InetSocketAddressnode(): 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()Instanceconfigured?yesNoreturnTarantool3Container.start()Create a temporarymount directoryon the hostmountDirectoryMount directoriesmountDirectoryon the host and/datain the containerDoes the configuration fileexist and is it a regularfile?YesNoMount the path to the configuration filepathToConfigFileto the file/data/configFileNamein the containerNotify the client viaLOGGER::info(...), that the configuration filewas copied withspecifyinginputandtargetfilesNotify the client viaLOGGER::warn(...),that the configuration fileis not set, null, ordoes not existYesDoes the path to the migration directorypoint to a regular file?Notify the clientviaLOGGER::warn(...),that a path toa regular file was passedYesDoes the path to the migration directory null?NoNotify the clientviaLOGGER::warn(...),that the path to the migration directorydoes not exist or is nullMount the migration directorymigrationsDirto the directory/data/migrationsDirNamein the containerNotify the client viaLOGGER::info(...), thatthe migration directorywas copied with specifyinginputandtargetdirectoriesDo etcd addresseswere passed?YesNoUse configurationfrometcd. Set addresses andprefixes via variablesTT_CONFIG_ETCD_ENDPOINTS,TT_CONFIG_ETCD_PREFIXUse configurationspecified in the configurationfile. Set the path to the configuration filevia the variableTT_CONFIGreturnTarantool3Container::start()
Tarantool3Container::start()Instanceconfigured?yesNoreturnTarantool3Container.start()Create a temporarymount directoryon the hostmountDirectoryMount directoriesmountDirectoryon the host and/datain the containerDoes the configuration fileexist and is it a regularfile?YesNoMount the path to the configuration filepathToConfigFileto the file/data/configFileNamein the containerNotify the client viaLOGGER::info(...), that the configuration filewas copied withspecifyinginputandtargetfilesNotify the client viaLOGGER::warn(...),that the configuration fileis not set, null, ordoes not existYesDoes the path to the migration directorypoint to a regular file?Notify the clientviaLOGGER::warn(...),that a path toa regular file was passedYesDoes the path to the migration directory null?NoNotify the clientviaLOGGER::warn(...),that the path to the migration directorydoes not exist or is nullMount the migration directorymigrationsDirto the directory/data/migrationsDirNamein the containerNotify the client viaLOGGER::info(...), thatthe migration directorywas copied with specifyinginputandtargetdirectoriesDo etcd addresseswere passed?YesNoUse configurationfrometcd. Set addresses andprefixes via variablesTT_CONFIG_ETCD_ENDPOINTS,TT_CONFIG_ETCD_PREFIXUse configurationspecified in the configurationfile. Set the path to the configuration filevia the variableTT_CONFIGreturnTarantool3Container::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:

Is the container closed viaTarantool3Container::stop()?YesNoThrow an exceptionConfigure the containerMark that the container is configuredNoIs the container already configured?YesreturnTarantool3Container::start()
Is the container closed viaTarantool3Container::stop()?YesNoThrow an exceptionConfigure the containerMark that the container is configuredNoIs the container already configured?YesreturnTarantool3Container::start()

Stop the containerNoIs the container closed via Tarantool3Container::stop()?YesreturnTarantool3Container::stopWithSafeMount()
Stop the containerNoIs the container closed via Tarantool3Container::stop()?YesreturnTarantool3Container::stopWithSafeMount()

Delete mounted directoriesStop the containerMark that the container is stoppedNoIs the container closed via Tarantool3Container::stop()?YesreturnTarantool3Container::stop()
Delete mounted directoriesStop the containerMark that the container is stoppedNoIs the container closed via Tarantool3Container::stop()?YesreturnTarantool3Container::stop()

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().