Documentation
¶
Index ¶
- Constants
- Variables
- func NewBlockStoreBuilder(le *logrus.Entry, conf *Config) block_store_controller.BlockStoreBuilder
- type Config
- func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *Config) CloneVT() *Config
- func (this *Config) EqualMessageVT(thatMsg any) bool
- func (this *Config) EqualVT(that *Config) bool
- func (c *Config) EqualsConfig(other config.Config) bool
- func (x *Config) GetBlockStoreId() string
- func (x *Config) GetBucketIds() []string
- func (x *Config) GetClient() *redis.ClientConfig
- func (c *Config) GetConfigID() string
- func (x *Config) GetDisableHashGet() bool
- func (x *Config) GetForceHashType() hash.HashType
- func (x *Config) GetKvKeyOpts() *kvkey.Config
- func (x *Config) GetSkipNotFound() bool
- func (x *Config) GetVerbose() bool
- func (x *Config) MarshalJSON() ([]byte, error)
- func (x *Config) MarshalProtoJSON(s *json.MarshalState)
- func (x *Config) MarshalProtoText() string
- func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Config) MarshalToVT(dAtA []byte) (int, error)
- func (m *Config) MarshalVT() (dAtA []byte, err error)
- func (*Config) ProtoMessage()
- func (x *Config) Reset()
- func (m *Config) SizeVT() (n int)
- func (x *Config) String() string
- func (x *Config) UnmarshalJSON(b []byte) error
- func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *Config) UnmarshalVT(dAtA []byte) error
- func (c *Config) Validate() error
- type Controller
- type Factory
- func (t *Factory) Construct(ctx context.Context, conf config.Config, opts controller.ConstructOpts) (controller.Controller, error)
- func (t *Factory) ConstructConfig() config.Config
- func (t *Factory) GetConfigID() string
- func (t *Factory) GetControllerID() string
- func (t *Factory) GetVersion() semver.Version
- type RedisBlock
Constants ¶
const ConfigID = ControllerID
ConfigID is the string used to identify this config object.
const ControllerID = "hydra/block/store/redis"
ControllerID identifies the redis block store controller.
Variables ¶
var Version = semver.MustParse("0.0.1")
Version is the version of the block store implementation.
Functions ¶
func NewBlockStoreBuilder ¶
func NewBlockStoreBuilder(le *logrus.Entry, conf *Config) block_store_controller.BlockStoreBuilder
NewBlockStoreBuilder constructs a new block store builder from config.
Types ¶
type Config ¶
type Config struct {
// BlockStoreId is the block store id to use on the bus.
BlockStoreId string `protobuf:"bytes,1,opt,name=block_store_id,json=blockStoreId,proto3" json:"blockStoreId,omitempty"`
// Client configures the redis client.
Client *redis.ClientConfig `protobuf:"bytes,2,opt,name=client,proto3" json:"client,omitempty"`
// KvKeyOpts are key/value key constants.
// Optional.
KvKeyOpts *kvkey.Config `protobuf:"bytes,3,opt,name=kv_key_opts,json=kvKeyOpts,proto3" json:"kvKeyOpts,omitempty"`
// ForceHashType forces writing the given hash type to the store.
// If unset, accepts any hash type.
ForceHashType hash.HashType `protobuf:"varint,4,opt,name=force_hash_type,json=forceHashType,proto3" json:"forceHashType,omitempty"`
// DisableHashGet disables hashing values for Get requests.
// This improves performance if the underlying store is trusted & consistent.
//
// If the store may return invalid data or mismatch the requested block ref,
// do not enable this option. It is important to hash the data for each read.
DisableHashGet bool `protobuf:"varint,8,opt,name=disable_hash_get,json=disableHashGet,proto3" json:"disableHashGet,omitempty"`
// BucketIds is a list of bucket ids to serve LookupBlockFromNetwork directives.
BucketIds []string `protobuf:"bytes,5,rep,name=bucket_ids,json=bucketIds,proto3" json:"bucketIds,omitempty"`
// SkipNotFound skips returning a value if the block was not found.
SkipNotFound bool `protobuf:"varint,6,opt,name=skip_not_found,json=skipNotFound,proto3" json:"skipNotFound,omitempty"`
// Verbose enables verbose logging of the block store.
Verbose bool `protobuf:"varint,7,opt,name=verbose,proto3" json:"verbose,omitempty"`
// contains filtered or unexported fields
}
Config configures the Redis block store controller.
func NewConfig ¶
func NewConfig(blockStoreId string, clientConfig *store_kvtx_redis.ClientConfig) *Config
NewConfig constructs a new config.
func (*Config) CloneMessageVT ¶
func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*Config) EqualMessageVT ¶
func (*Config) EqualsConfig ¶
EqualsConfig checks if the config is equal to another.
func (*Config) GetBlockStoreId ¶
func (*Config) GetBucketIds ¶
func (*Config) GetClient ¶
func (x *Config) GetClient() *redis.ClientConfig
func (*Config) GetConfigID ¶
GetConfigID returns the unique string for this configuration type.
func (*Config) GetDisableHashGet ¶
func (*Config) GetForceHashType ¶
func (*Config) GetKvKeyOpts ¶
func (*Config) GetSkipNotFound ¶
func (*Config) GetVerbose ¶
func (*Config) MarshalJSON ¶
MarshalJSON marshals the Config to JSON.
func (*Config) MarshalProtoJSON ¶
func (x *Config) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Config message to JSON.
func (*Config) MarshalProtoText ¶
func (*Config) MarshalToSizedBufferVT ¶
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
func (*Config) UnmarshalJSON ¶
UnmarshalJSON unmarshals the Config from JSON.
func (*Config) UnmarshalProtoJSON ¶
func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Config message from JSON.
func (*Config) UnmarshalVT ¶
type Controller ¶
type Controller = block_store_controller.Controller
Controller implements the redis block store controller.
func NewController ¶
func NewController(le *logrus.Entry, conf *Config) *Controller
NewController builds a new redis block store controller.
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory constructs the redis block store.
func (*Factory) Construct ¶
func (t *Factory) Construct( ctx context.Context, conf config.Config, opts controller.ConstructOpts, ) (controller.Controller, error)
Construct constructs the associated controller given configuration.
func (*Factory) ConstructConfig ¶
ConstructConfig constructs an instance of the controller configuration.
func (*Factory) GetConfigID ¶
GetConfigID returns the configuration ID for the controller.
func (*Factory) GetControllerID ¶
GetControllerID returns the unique ID for the controller.
func (*Factory) GetVersion ¶
GetVersion returns the version of this controller.
type RedisBlock ¶
type RedisBlock = block_store_kvtx.KVTxBlock
RedisBlock is a block store on top of a Redis database. Stores blocks at {objectPrefix}/{block ref}
func NewRedisBlock ¶
func NewRedisBlock( kvk *kvkey.KVKey, st *store_kvtx_redis.Store, forceHashType hash.HashType, hashGet bool, ) *RedisBlock
NewRedisBlock builds a new block store on top of a redis db.
forceHashType can be 0 to use the default hash type. hashGet hashes Get requests for integrity, use if the storage is unreliable or untrusted.