Documentation
¶
Overview ¶
Package chirpstore implements a Chirp v0 client and server exposing the blob.KV interface.
See https://github.com/creachadair/chirp for information about Chirp v0. See https://godoc.org/creachadair/ffs for information about blob.KV.
Index ¶
- type DeleteRequest
- type GetRequest
- type HasRequest
- type IDKeyRequest
- type IDOnly
- type KV
- func (s KV) Delete(ctx context.Context, key string) error
- func (s KV) Get(ctx context.Context, key string) ([]byte, error)
- func (s KV) Has(ctx context.Context, keys ...string) (blob.KeySet, error)
- func (s KV) Len(ctx context.Context) (int64, error)
- func (s KV) List(ctx context.Context, start string) iter.Seq2[string, error]
- func (s KV) Put(ctx context.Context, opts blob.PutOptions) error
- func (s KV) Status(ctx context.Context) ([]byte, error)
- type KeyspaceRequest
- type KeyspaceResponse
- type LenRequest
- type ListRequest
- type ListResponse
- type PutRequest
- type Service
- func (s *Service) Delete(ctx context.Context, req *chirp.Request) ([]byte, error)
- func (s *Service) Get(ctx context.Context, req *chirp.Request) ([]byte, error)
- func (s *Service) Has(ctx context.Context, req *chirp.Request) ([]byte, error)
- func (s *Service) KV(ctx context.Context, req *chirp.Request) ([]byte, error)
- func (s *Service) Len(ctx context.Context, req *chirp.Request) ([]byte, error)
- func (s *Service) List(ctx context.Context, req *chirp.Request) ([]byte, error)
- func (s *Service) Put(ctx context.Context, req *chirp.Request) ([]byte, error)
- func (s *Service) Register(p *chirp.Peer)
- func (s *Service) Status(ctx context.Context, req *chirp.Request) ([]byte, error)
- func (s *Service) Sub(ctx context.Context, req *chirp.Request) ([]byte, error)
- type ServiceOptions
- type Store
- type StoreOptions
- type SubRequest
- type SubResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeleteRequest ¶
type DeleteRequest = IDKeyRequest
type GetRequest ¶
type GetRequest = IDKeyRequest
type HasRequest ¶
HasRequest is an encoding wrapper for the arguments of the Has method.
func (*HasRequest) Decode ¶
func (s *HasRequest) Decode(data []byte) error
Decode parses data into the contents of s.
func (HasRequest) Encode ¶
func (s HasRequest) Encode() []byte
Encode converts s into a binary string.
type IDKeyRequest ¶
IDKeyRequest is a shared type for requests that take an ID and a key.
func (*IDKeyRequest) Decode ¶
func (r *IDKeyRequest) Decode(data []byte) error
Decode data from binary format and replace the contents of g.
func (IDKeyRequest) Encode ¶
func (r IDKeyRequest) Encode() []byte
Encode converts g into a binary string for request data.
type IDOnly ¶
type IDOnly struct {
ID int
}
IDOnly is a shared type for requests and responses that report only an ID.
type KV ¶
type KV struct {
// contains filtered or unexported fields
}
KV implements the blob.KV interface by calling a Chirp v0 peer.
type KeyspaceRequest ¶
type KeyspaceRequest = IDKeyRequest
KeyspaceRequest is the encoding wrapper for a Keyspace request.
type KeyspaceResponse ¶
type KeyspaceResponse = IDOnly
KeyspaceResponse is the encoding wrapper for a Keyspace response.
type ListRequest ¶
ListRequest is the an encoding wrapper for the arguments to the List method.
func (*ListRequest) Decode ¶
func (r *ListRequest) Decode(data []byte) error
Decode data from binary format and replace the contents of r.
func (ListRequest) Encode ¶
func (r ListRequest) Encode() []byte
Encode converts r into a binary string for request data.
type ListResponse ¶
ListResponse is the an encoding wrapper for the List method response.
func (*ListResponse) Decode ¶
func (r *ListResponse) Decode(data []byte) error
Decode data from binary format and replaces the contents of r.
func (ListResponse) Encode ¶
func (r ListResponse) Encode() []byte
Encode converts r into a binary string for response data.
type PutRequest ¶
PutRequest is an encoding wrapper for the arguments of the Put method.
func (*PutRequest) Decode ¶
func (p *PutRequest) Decode(data []byte) error
Decode data from binary format and replace the contents of p.
func (PutRequest) Encode ¶
func (p PutRequest) Encode() []byte
Encode converts p into a binary string for request data.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(st blob.Store, opts *ServiceOptions) *Service
NewService constructs a service that delegates to the given blob.KV.
func (*Service) KV ¶
KV implements the eponymous method of the blob.Store interface. The client is returned an integer descriptor (ID) that must be presented in subsequent requests to identify which keyspace to affect.
func (*Service) Register ¶
Register adds method handlers to p for each of the applicable methods of s.
func (*Service) Sub ¶
Sub implements the eponymous method of the blob.Store interface. The client is returned an integer descriptor (ID) that must be presented in subsequent substore and keyspace requests to identify which store to affect.
type ServiceOptions ¶
type ServiceOptions struct { // A prefix to prepend to all the method names exported by the service. Prefix string }
ServiceOptions provides optional settings for constructing a Service.
type Store ¶
Store implements the blob.StoreCloser interface by delegating requests to a Chirp v0 peer. Store and KV operations are delegated to the remote peer.
type StoreOptions ¶
type StoreOptions struct { // A prefix to prepend to all the method names exported by the service. MethodPrefix string }
StoreOptions provide optional settings for a Store. A nil is ready for use and provides default values.
type SubRequest ¶
type SubRequest = IDKeyRequest
SubRequest is the encoding wrapper for a Sub request.
type SubResponse ¶
type SubResponse = IDOnly
SubResponse is the encoding wrapper for a Sub response.