Documentation
¶
Overview ¶
Package storeservice implements a storage service over Chirp.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Address is the address at which the service listens for connections. // This must be non-empty. Address string // Store is the storage exported by the service. // This must be non-nil. Store blob.StoreCloser // ReadOnly, if true, causes methods that modify the store to report errors // when called. ReadOnly bool // Compress, if true, enables zstd compression on the store. Compress bool // EncryptionKey, if non-empty, is used as an encryption key to wrap the // store. Blobs are encrypted using a chacha20-poly1305 AEAD. // A valid key must be 32 bytes in length, or New will panic. EncryptionKey []byte // CacheSizeBytes, if positive, wraps the store in a memory cache of the // specified size. If zero or negative, no cache is enabled. CacheSizeBytes int // Buffer, if non-nil, uses the specified KV as a writeback buffer for // writes to the underlying store. Buffer blob.KV // MethodPrefix is prepended to the method names exportd by the service. // Any caller must use the same prefix. MethodPrefix string // Logf, if set, is used to write text debug logs. // If nil, logs are discarded. Logf func(string, ...any) }
Config carries the settings for a Service. The Address and Store fields are required.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages a running server, accepting connections and delegating them to a peer implementing the chirpstore.Service methods.
func New ¶
New creates a new, unstarted service for the specified config. It will panic if any required config fields are missing. The caller must call Service.Start to start the service.
func (*Service) Root ¶
Root returns the root peer for the service. The caller may modify this peer, and such changes will affect future connections to the service but will not affect existing connections.
func (*Service) Start ¶
Start starts up the service loop for s. It will panic if s has already been started; otherwise it reports whether startup succeeded. Once started, s will run until ctx ends or Service.Stop is called. Start does not block while the service runs; call Service.Wait to wait for the service to shut down.