Documentation
¶
Index ¶
- Constants
- type Backend
- func (ab *Backend) Close(ctx context.Context) (err error)
- func (ab *Backend) Flush(ctx context.Context) (err error)
- func (ab *Backend) Geometry(ctx context.Context) (nbd.Geometry, error)
- func (ab *Backend) GoBackground(ctx context.Context)
- func (ab *Backend) HasFlush(ctx context.Context) bool
- func (ab *Backend) HasFua(ctx context.Context) bool
- func (ab *Backend) ReadAt(ctx context.Context, offset, length int64) (payload []byte, err error)
- func (ab *Backend) TrimAt(ctx context.Context, offset, length int64) (int64, error)
- func (ab *Backend) WriteAt(ctx context.Context, b []byte, offset int64) (bytesWritten int64, err error)
- func (ab *Backend) WriteZeroesAt(ctx context.Context, offset, length int64) (bytesWritten int64, err error)
- type BackendFactory
- type BackendFactoryConfig
- type DialFunc
- type RedisPool
Constants ¶
const ( // DefaultLBACacheLimit defines the default cache limit DefaultLBACacheLimit = 20 * mebibyteAsBytes // 20 MiB )
shared constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend is a nbd.Backend implementation on top of ARDB
func (*Backend) GoBackground ¶
GoBackground implements Backend.GoBackground and the actual work is delegated to the underlying storage
type BackendFactory ¶
type BackendFactory struct {
// contains filtered or unexported fields
}
BackendFactory holds some variables that can not be passed in the exportconfig like the pool of ardbconnections I hate the factory pattern but I hate global variables even more
func NewBackendFactory ¶
func NewBackendFactory(cfg BackendFactoryConfig) (*BackendFactory, error)
NewBackendFactory creates a new Backend Factory, which is used to create a Backend, without having to work with global variables.
func (*BackendFactory) NewBackend ¶
func (f *BackendFactory) NewBackend(ctx context.Context, ec *nbd.ExportConfig) (backend nbd.Backend, err error)
NewBackend generates a new ardb backend
type BackendFactoryConfig ¶
type BackendFactoryConfig struct {
Pool *RedisPool
ConfigHotReloader config.HotReloader
TLogRPCAddress string
RootARDBConnectionString string
LBACacheLimit int64 // min-capped to LBA.BytesPerShard
ConfigPath string
}
BackendFactoryConfig is used to create a new BackendFactory
func (*BackendFactoryConfig) Validate ¶
func (cfg *BackendFactoryConfig) Validate() error
Validate all the parameters of this BackendFactoryConfig
type DialFunc ¶
DialFunc creates a redis.Conn (if possible), based on a given connectionString and database.
type RedisPool ¶
type RedisPool struct {
Dial DialFunc
// contains filtered or unexported fields
}
RedisPool maintains a collection of redis.Pool's per connection's database. The application calls the Get method to get a database connection from the pool and the connection's Close method to return the connection's resources to the pool.
The normal redigo.Pool is not adequate since it only maintains connections for a single server.
func NewRedisPool ¶
NewRedisPool creates a new pool for multiple redis servers
func (*RedisPool) Close ¶
func (p *RedisPool) Close()
Close releases the resources used by the pool.
func (*RedisPool) Get ¶
Get gets a connection. The application must close the returned connection. This method always returns a valid connection so that applications can defer error handling to the first use of the connection. If there is an error getting an underlying connection, then the connection Err, Do, Send, Flush and Receive methods return that error.