Documentation ¶
Index ¶
- Constants
- Variables
- func ReadCheckMessageType(rd io.Reader) (uint8, error)
- func WriteMessageType(w io.Writer, mType uint8) error
- type AESDecrypter
- type AESEncrypter
- type BlockStatus
- type HandshakeStatus
- type RedisPool
- func AnyRedisPool(cfg RedisPoolConfig) (RedisPool, error)
- func InMemoryRedisPool(requiredDataServerCount int) RedisPool
- func NewRedisPool(requiredDataServerCount int, storageServers []config.StorageServerConfig) (RedisPool, error)
- func RedisPoolFromConfig(configPath, vdiskID string, requiredDataServerCount int) (RedisPool, error)
- type RedisPoolConfig
- type RedisPoolFactory
- func AnyRedisPoolFactory(cfg RedisPoolFactoryConfig) (RedisPoolFactory, error)
- func ConfigRedisPoolFactory(requiredDataServerCount int, configPath string) (RedisPoolFactory, error)
- func InMemoryRedisPoolFactory(requiredDataServerCount int) RedisPoolFactory
- func StaticRedisPoolFactory(requiredDataServerCount int, storageServers []config.StorageServerConfig) (RedisPoolFactory, error)
- type RedisPoolFactoryConfig
Constants ¶
const ( KeySize = 32 // 256-bit key NonceSize = 12 // 96-bit nonce )
static sizes
const ( MessageTlogBlock // tlog block MessageForceFlush // force flush MessageForceFlushAtSeq // force flush at sequence )
Type of message sent from client to server
const (
// LastHashPrefix is the last hash ardb key prefix
LastHashPrefix = "last_hash_"
)
Variables ¶
var ( // FirstAggregateHash is used as the prevHash value // for the first aggregation FirstAggregateHash = blockstor.NilHash )
var ( // MinSupportedVersion is the minimum supported version // that the tlog client and server of this version supports MinSupportedVersion = blockstor.NewVersion(1, 1, 0, blockstor.VersionStageAlpha) )
Functions ¶
func ReadCheckMessageType ¶
ReadCheckMessageType reads type of message from given reader and check the validity of the type
Types ¶
type AESDecrypter ¶
AESDecrypter decrypts ciphertext, encrypted by the AESEncrypter, into plaintext.
func NewAESDecrypter ¶
func NewAESDecrypter(privKey, hexNonce string) (decrypter AESDecrypter, err error)
NewAESDecrypter creates a new decrypter, using the given private key and nonce, ready to decrypt your ciphertext (that was encrypted by the AESEncrypter)
type AESEncrypter ¶
AESEncrypter encrypts plaintext into ciphertext, and can be decrypted by using the Decrypter
func NewAESEncrypter ¶
func NewAESEncrypter(privKey, hexNonce string) (encrypter AESEncrypter, err error)
NewAESEncrypter creates a new encrypter, using the given private key and nonce, ready to encrypt your plaintext
type BlockStatus ¶
type BlockStatus int8
BlockStatus is returned by the Tlog server when received block
const ( BlockStatusFlushFailed BlockStatus = -2 BlockStatusRecvFailed BlockStatus = -1 BlockStatusRecvOK BlockStatus = 1 BlockStatusFlushOK BlockStatus = 2 BlockStatusForceFlushReceived BlockStatus = 3 )
Tlog Response status values
func (BlockStatus) Error ¶
func (status BlockStatus) Error() error
Error returns this status as an error, returning nil if the status is not an error
func (BlockStatus) Int8 ¶
func (status BlockStatus) Int8() int8
Int8 returns the block status as an int8 value
func (BlockStatus) String ¶
func (status BlockStatus) String() string
String returns the name of the block status
type HandshakeStatus ¶
type HandshakeStatus int8
HandshakeStatus is returned by the Tlog server when receiving the initial handshake message from the client
const ( // returned when something went wrong internally // in the tlogserver during the handshake phase HandshakeStatusInternalServerError HandshakeStatus = -4 // returned when the given VdiskID is not legal // could be because it's not valid, or because it already // exists on the server HandshakeStatusInvalidVdiskID HandshakeStatus = -3 // returned when the given version by the client // was not supported by the server HandshakeStatusInvalidVersion HandshakeStatus = -2 // returned when the given request by the client // could not be read HandshakeStatusInvalidRequest HandshakeStatus = -1 // returned when all information was accepted HandshakeStatusOK HandshakeStatus = 1 )
Handshake status values
func (HandshakeStatus) Error ¶
func (status HandshakeStatus) Error() error
Error returns this status as an error, returning nil if the status is not an error
func (HandshakeStatus) Int8 ¶
func (status HandshakeStatus) Int8() int8
Int8 returns the Handshake status as an int8 value
func (HandshakeStatus) String ¶
func (status HandshakeStatus) String() string
String returns the name of the Hanshake status
type RedisPool ¶
type RedisPool interface { // returns amount of DataConnection servers available DataConnectionCount() int // The application calls the DataConnection with a valid index // to get a connection from the pool of data servers. // It is important that the caller of this function closes the // received connection to return the connection's resources back to the pool. DataConnection(index int) redis.Conn // Close all open resources. Close() }
RedisPool maintains a collection of premade redis.Pool's,
func AnyRedisPool ¶
func AnyRedisPool(cfg RedisPoolConfig) (RedisPool, error)
AnyRedisPool creates any kind of RedisPool based on the given parameters. + if server configs are given, a RedisPool based on those will be created;
- if autoFill is true, any missing server configs will be interfered based on the last given server Config (assuming sequential ports);
- if no server configs are given but the configPath is set, a RedisPool will be created from that config file;
- if no config path and no server configs are given, and allowInMemory is true, an inmemory redis pool will be created instead;
func InMemoryRedisPool ¶
InMemoryRedisPool creates a redis pool using in-memory ardb storage servers.
func NewRedisPool ¶
func NewRedisPool(requiredDataServerCount int, storageServers []config.StorageServerConfig) (RedisPool, error)
NewRedisPool creates a redis pool using the given servers.
type RedisPoolConfig ¶
type RedisPoolConfig struct { // RequiredDataServerCount is required by all types of // redis pools, in order to validate or create the right amount // of storage servers. RequiredDataServerCount int // When ConfigPath is set, and no ServerConfigs have been specified, // the redis pool will be created using the config found on this path. ConfigPath string // The vdisk ID to use, // only required in case the config path is given. VdiskID string // Create a redis pool straight from these server configs, // the redis pool requires RequiredDataServerCount+1 configs to be specified ServerConfigs []config.StorageServerConfig // AutoFill allows you to automatically complete the server config slice, // in case not enough server configs (RequiredDataServerCount+1) have been given. // Auto filling is done, by assuming that all missing servers are on // the same IP address of the last given server config, using sequential ports, // following the port of that last given server config. AutoFill bool // Enable this boolean, in case you want to allow an in-memory redis pool. AllowInMemory bool }
RedisPoolConfig used to create any kind of supported redis pool, based on the properties set in this config. Note that this config should only be used because the choice is made by input given by the user in one way or another. If the choice is known on compile time, use the correct constructor instead.
type RedisPoolFactory ¶
type RedisPoolFactory interface { // NewRedisPool creates a new redis pool for the given vdisk. // An error is returned in case that vdisk couldn't be found, // or in case that vdisk has not enough (n < k+m) dataservers linked to it, // in order to create a valid RedisPool. NewRedisPool(vdiskID string) (RedisPool, error) }
RedisPoolFactory creates a redis pool for a given vdisk.
func AnyRedisPoolFactory ¶
func AnyRedisPoolFactory(cfg RedisPoolFactoryConfig) (RedisPoolFactory, error)
AnyRedisPoolFactory creates any kind of RedisPoolFactory based on the given parameters. + if server configs are given, a static RedisPoolFactory will be created;
- if autoFill is true, any missing server configs will be interfered based on the last given server Config (assuming sequential ports);
- if no server configs are given but the configPath is set, a RedisPoolFactory based on that config file will be created;
- if no config path and no server configs are given, an inmemory redis pool will be created instead;
func ConfigRedisPoolFactory ¶
func ConfigRedisPoolFactory(requiredDataServerCount int, configPath string) (RedisPoolFactory, error)
ConfigRedisPoolFactory creates a RedisPoolFactory using a blockstor config file. The required amount of data servers is specified upfront, such that at creation of a RedisPool, it is validated that the storage cluster in question has sufficient data servers available.
func InMemoryRedisPoolFactory ¶
func InMemoryRedisPoolFactory(requiredDataServerCount int) RedisPoolFactory
InMemoryRedisPoolFactory creates a static RedisPoolFactory, which returns the same valid inmemory RedisPool for all vdisks, and thus it will always return a valid RedisPool.
func StaticRedisPoolFactory ¶
func StaticRedisPoolFactory(requiredDataServerCount int, storageServers []config.StorageServerConfig) (RedisPoolFactory, error)
StaticRedisPoolFactory creates a RedisPoolFactory, which returns the same valid RedisPool for all vdisks, and thus it will always return a valid RedisPool.
type RedisPoolFactoryConfig ¶
type RedisPoolFactoryConfig struct { // RequiredDataServerCount is required by all types of // redis pool factories, in order to validate or create the right amount // of storage servers. RequiredDataServerCount int // When ConfigPath is set, and no ServerConfigs have been specified, // the redis pool factory will be created using the config found on this path. ConfigPath string // Create a redis pool factory straight from these server configs, // the redis pool factor) requires RequiredDataServerCount+1 configs to be specified ServerConfigs []config.StorageServerConfig // AutoFill allows you to automatically complete the server config slice, // in case not enough server configs (RequiredDataServerCount+1) have been given. // Auto filling is done, by assuming that all missing servers are on // the same IP address of the last given server config, using sequential ports, // following the port of that last given server config. AutoFill bool // Enable this boolean, in case you want to allow an in-memory redis pool (factory). AllowInMemory bool }
RedisPoolFactoryConfig used to create any kind of supported redis pool factory, based on the properties set in this config. Note that this config should only be used because the choice is made by input given by the user in one way or another. If the choice is known on compile time, use the correct constructor instead.