block_store_http_server

package
v0.56.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigID = ControllerID

ConfigID is the string used to identify this config object.

View Source
const ControllerID = "hydra/block/store/http/server"

ControllerID is the controller identifier.

Variables

View Source
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) CloneVT

func (m *Config) CloneVT() *Config

func (*Config) EqualMessageVT

func (this *Config) EqualMessageVT(thatMsg any) bool

func (*Config) EqualVT

func (this *Config) EqualVT(that *Config) bool

func (*Config) EqualsConfig

func (c *Config) EqualsConfig(other config.Config) bool

EqualsConfig checks if the config is equal to another.

func (*Config) GetBlockStoreId

func (x *Config) GetBlockStoreId() string

func (*Config) GetConfigID

func (c *Config) GetConfigID() string

GetConfigID returns the unique string for this configuration type.

func (*Config) GetForceHashType

func (x *Config) GetForceHashType() hash.HashType

func (*Config) GetPathPrefix

func (x *Config) GetPathPrefix() string

func (*Config) GetWrite

func (x *Config) GetWrite() bool

func (*Config) MarshalJSON

func (x *Config) MarshalJSON() ([]byte, error)

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 (x *Config) MarshalProtoText() string

func (*Config) MarshalToSizedBufferVT

func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Config) MarshalToVT

func (m *Config) MarshalToVT(dAtA []byte) (int, error)

func (*Config) MarshalVT

func (m *Config) MarshalVT() (dAtA []byte, err error)

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) Reset

func (x *Config) Reset()

func (*Config) SizeVT

func (m *Config) SizeVT() (n int)

func (*Config) String

func (x *Config) String() string

func (*Config) UnmarshalJSON

func (x *Config) UnmarshalJSON(b []byte) error

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

func (m *Config) UnmarshalVT(dAtA []byte) error

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration.

type Controller

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 NewFactory

func NewFactory(bus bus.Bus) *Factory

NewFactory builds the factory.

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

func (t *Factory) ConstructConfig() config.Config

ConstructConfig constructs an instance of the controller configuration.

func (*Factory) GetConfigID

func (t *Factory) GetConfigID() string

GetConfigID returns the configuration ID for the controller.

func (*Factory) GetControllerID

func (t *Factory) GetControllerID() string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL