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 // Prefix is prepended to the method names exportd by the service. // Any caller must use the same prefix. Prefix 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.