Documentation
¶
Index ¶
- Constants
- Variables
- 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 (c *Config) GetConfigID() string
- func (x *Config) GetForceHashType() hash.HashType
- func (x *Config) GetPathPrefix() string
- func (x *Config) GetWrite() 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() controller.Version
- type HTTPBlockServer
- func (h *HTTPBlockServer) ServeGetBlock(ctx context.Context, rw http.ResponseWriter, ref *block.BlockRef)
- func (h *HTTPBlockServer) ServeGetBlockExists(ctx context.Context, rw http.ResponseWriter, ref *block.BlockRef)
- func (h *HTTPBlockServer) ServeHTTP(rw http.ResponseWriter, req *http.Request)
- func (h *HTTPBlockServer) ServePutBlock(ctx context.Context, rw http.ResponseWriter, reqBody io.ReadCloser)
- func (h *HTTPBlockServer) ServeRmBlock(ctx context.Context, rw http.ResponseWriter, ref *block.BlockRef)
Constants ¶
const ConfigID = ControllerID
ConfigID is the string used to identify this config object.
const ControllerID = "hydra/block/store/http/server"
ControllerID is the controller identifier.
Variables ¶
var Version = controller.MustParseVersion("0.0.1")
Version is the controller version.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// BlockStoreId is the block store id to lookup on the bus.
BlockStoreId string `protobuf:"bytes,1,opt,name=block_store_id,json=blockStoreId,proto3" json:"blockStoreId,omitempty"`
// Write enables the write api endpoints (put, delete).
Write bool `protobuf:"varint,2,opt,name=write,proto3" json:"write,omitempty"`
// PathPrefix is the path prefix to use for requests.
// [path_prefix]/{get,put,exists,rm}
// Can be empty.
PathPrefix string `protobuf:"bytes,3,opt,name=path_prefix,json=pathPrefix,proto3" json:"pathPrefix,omitempty"`
// ForceHashType forces writing the given hash type to the store.
// If unset, accepts any hash type the underlying bucket accepts.
ForceHashType hash.HashType `protobuf:"varint,4,opt,name=force_hash_type,json=forceHashType,proto3" json:"forceHashType,omitempty"`
// contains filtered or unexported fields
}
Config configures the block store http server.
Handles LookupHTTPHandler with the block store endpoints.
func NewConfig ¶
func NewConfig(blockStoreID string, write bool, pathPrefix string, forceHashType hash.HashType) *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) GetConfigID ¶
GetConfigID returns the unique string for this configuration type.
func (*Config) GetForceHashType ¶
func (*Config) GetPathPrefix ¶
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 = bifrost_http.HTTPHandlerController
Controller is the block store http server controller.
Handles LookupHTTPHandler with the block store endpoints.
func NewController ¶
func NewController(b bus.Bus, conf *Config) *Controller
NewController constructs a new http handler controller.
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory constructs the http server
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 ¶
func (t *Factory) GetVersion() controller.Version
GetVersion returns the version of this controller.
type HTTPBlockServer ¶
type HTTPBlockServer struct {
// contains filtered or unexported fields
}
HTTPBlockServer is HTTP server serving a BlockStore.
func NewHTTPBlock ¶
func NewHTTPBlock(store block.StoreOps, write bool, pathPrefix string, forceHashType hash.HashType) *HTTPBlockServer
NewHTTPBlockServer builds a new block store server on top of a block store.
if write=false, supports read operations only. pathPrefix is the URL path prefix for block store ops. forceHashType can be 0 to use the default hash type. if forceHashType is set, returns an error if the client attempts to force a different hash type.
func (*HTTPBlockServer) ServeGetBlock ¶
func (h *HTTPBlockServer) ServeGetBlock(ctx context.Context, rw http.ResponseWriter, ref *block.BlockRef)
ServeGetBlock serves a get block request. ref must have been validated already.
func (*HTTPBlockServer) ServeGetBlockExists ¶
func (h *HTTPBlockServer) ServeGetBlockExists(ctx context.Context, rw http.ResponseWriter, ref *block.BlockRef)
ServeGetBlockExists serves a get block exists request. ref must have been validated already.
func (*HTTPBlockServer) ServeHTTP ¶
func (h *HTTPBlockServer) ServeHTTP(rw http.ResponseWriter, req *http.Request)
ServeHTTP serves the HTTP server at pathPrefix.
func (*HTTPBlockServer) ServePutBlock ¶
func (h *HTTPBlockServer) ServePutBlock(ctx context.Context, rw http.ResponseWriter, reqBody io.ReadCloser)
ServePutBlock serves a put block request. ref must have been validated already.
func (*HTTPBlockServer) ServeRmBlock ¶
func (h *HTTPBlockServer) ServeRmBlock(ctx context.Context, rw http.ResponseWriter, ref *block.BlockRef)
ServeRmBlock serves a rm block request. ref must have been validated already.