Documentation ¶
Index ¶
- type DatabaseClient
- func (db *DatabaseClient) Close() error
- func (db *DatabaseClient) Compact(start, limit []byte) error
- func (db *DatabaseClient) Delete(key []byte) error
- func (db *DatabaseClient) Get(key []byte) ([]byte, error)
- func (db *DatabaseClient) Has(key []byte) (bool, error)
- func (db *DatabaseClient) HealthCheck() (interface{}, error)
- func (db *DatabaseClient) NewBatch() database.Batch
- func (db *DatabaseClient) NewIterator() database.Iterator
- func (db *DatabaseClient) NewIteratorWithPrefix(prefix []byte) database.Iterator
- func (db *DatabaseClient) NewIteratorWithStart(start []byte) database.Iterator
- func (db *DatabaseClient) NewIteratorWithStartAndPrefix(start, prefix []byte) database.Iterator
- func (db *DatabaseClient) Put(key, value []byte) error
- type DatabaseServer
- func (db *DatabaseServer) Close(context.Context, *rpcdbpb.CloseRequest) (*rpcdbpb.CloseResponse, error)
- func (db *DatabaseServer) Compact(_ context.Context, req *rpcdbpb.CompactRequest) (*rpcdbpb.CompactResponse, error)
- func (db *DatabaseServer) Delete(_ context.Context, req *rpcdbpb.DeleteRequest) (*rpcdbpb.DeleteResponse, error)
- func (db *DatabaseServer) Get(_ context.Context, req *rpcdbpb.GetRequest) (*rpcdbpb.GetResponse, error)
- func (db *DatabaseServer) Has(_ context.Context, req *rpcdbpb.HasRequest) (*rpcdbpb.HasResponse, error)
- func (db *DatabaseServer) HealthCheck(context.Context, *emptypb.Empty) (*rpcdbpb.HealthCheckResponse, error)
- func (db *DatabaseServer) IteratorError(_ context.Context, req *rpcdbpb.IteratorErrorRequest) (*rpcdbpb.IteratorErrorResponse, error)
- func (db *DatabaseServer) IteratorNext(_ context.Context, req *rpcdbpb.IteratorNextRequest) (*rpcdbpb.IteratorNextResponse, error)
- func (db *DatabaseServer) IteratorRelease(_ context.Context, req *rpcdbpb.IteratorReleaseRequest) (*rpcdbpb.IteratorReleaseResponse, error)
- func (db *DatabaseServer) NewIteratorWithStartAndPrefix(_ context.Context, req *rpcdbpb.NewIteratorWithStartAndPrefixRequest) (*rpcdbpb.NewIteratorWithStartAndPrefixResponse, error)
- func (db *DatabaseServer) Put(_ context.Context, req *rpcdbpb.PutRequest) (*rpcdbpb.PutResponse, error)
- func (db *DatabaseServer) WriteBatch(_ context.Context, req *rpcdbpb.WriteBatchRequest) (*rpcdbpb.WriteBatchResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatabaseClient ¶
type DatabaseClient struct {
// contains filtered or unexported fields
}
DatabaseClient is an implementation of database that talks over RPC.
func NewClient ¶
func NewClient(client rpcdbpb.DatabaseClient) *DatabaseClient
NewClient returns a database instance connected to a remote database instance
func (*DatabaseClient) Close ¶
func (db *DatabaseClient) Close() error
Close attempts to close the database
func (*DatabaseClient) Compact ¶
func (db *DatabaseClient) Compact(start, limit []byte) error
Compact attempts to optimize the space utilization in the provided range
func (*DatabaseClient) Delete ¶
func (db *DatabaseClient) Delete(key []byte) error
Delete attempts to remove any mapping from the key
func (*DatabaseClient) Get ¶
func (db *DatabaseClient) Get(key []byte) ([]byte, error)
Get attempts to return the value that was mapped to the key that was provided
func (*DatabaseClient) Has ¶
func (db *DatabaseClient) Has(key []byte) (bool, error)
Has attempts to return if the database has a key with the provided value.
func (*DatabaseClient) HealthCheck ¶ added in v1.8.4
func (db *DatabaseClient) HealthCheck() (interface{}, error)
func (*DatabaseClient) NewBatch ¶
func (db *DatabaseClient) NewBatch() database.Batch
NewBatch returns a new batch
func (*DatabaseClient) NewIterator ¶
func (db *DatabaseClient) NewIterator() database.Iterator
func (*DatabaseClient) NewIteratorWithPrefix ¶
func (db *DatabaseClient) NewIteratorWithPrefix(prefix []byte) database.Iterator
func (*DatabaseClient) NewIteratorWithStart ¶
func (db *DatabaseClient) NewIteratorWithStart(start []byte) database.Iterator
func (*DatabaseClient) NewIteratorWithStartAndPrefix ¶
func (db *DatabaseClient) NewIteratorWithStartAndPrefix(start, prefix []byte) database.Iterator
NewIteratorWithStartAndPrefix returns a new empty iterator
func (*DatabaseClient) Put ¶
func (db *DatabaseClient) Put(key, value []byte) error
Put attempts to set the value this key maps to
type DatabaseServer ¶
type DatabaseServer struct { rpcdbpb.UnsafeDatabaseServer // contains filtered or unexported fields }
DatabaseServer is a database that is managed over RPC.
func NewServer ¶
func NewServer(db database.Database) *DatabaseServer
NewServer returns a database instance that is managed remotely
func (*DatabaseServer) Close ¶
func (db *DatabaseServer) Close(context.Context, *rpcdbpb.CloseRequest) (*rpcdbpb.CloseResponse, error)
Close delegates the Close call to the managed database and returns the result
func (*DatabaseServer) Compact ¶
func (db *DatabaseServer) Compact(_ context.Context, req *rpcdbpb.CompactRequest) (*rpcdbpb.CompactResponse, error)
Compact delegates the Compact call to the managed database and returns the result
func (*DatabaseServer) Delete ¶
func (db *DatabaseServer) Delete(_ context.Context, req *rpcdbpb.DeleteRequest) (*rpcdbpb.DeleteResponse, error)
Delete delegates the Delete call to the managed database and returns the result
func (*DatabaseServer) Get ¶
func (db *DatabaseServer) Get(_ context.Context, req *rpcdbpb.GetRequest) (*rpcdbpb.GetResponse, error)
Get delegates the Get call to the managed database and returns the result
func (*DatabaseServer) Has ¶
func (db *DatabaseServer) Has(_ context.Context, req *rpcdbpb.HasRequest) (*rpcdbpb.HasResponse, error)
Has delegates the Has call to the managed database and returns the result
func (*DatabaseServer) HealthCheck ¶ added in v1.8.4
func (db *DatabaseServer) HealthCheck(context.Context, *emptypb.Empty) (*rpcdbpb.HealthCheckResponse, error)
HealthCheck performs a heath check against the underlying database.
func (*DatabaseServer) IteratorError ¶
func (db *DatabaseServer) IteratorError(_ context.Context, req *rpcdbpb.IteratorErrorRequest) (*rpcdbpb.IteratorErrorResponse, error)
IteratorError attempts to report any errors that occurred during iteration
func (*DatabaseServer) IteratorNext ¶
func (db *DatabaseServer) IteratorNext(_ context.Context, req *rpcdbpb.IteratorNextRequest) (*rpcdbpb.IteratorNextResponse, error)
IteratorNext attempts to call next on the requested iterator
func (*DatabaseServer) IteratorRelease ¶
func (db *DatabaseServer) IteratorRelease(_ context.Context, req *rpcdbpb.IteratorReleaseRequest) (*rpcdbpb.IteratorReleaseResponse, error)
IteratorRelease attempts to release the resources allocated to an iterator
func (*DatabaseServer) NewIteratorWithStartAndPrefix ¶
func (db *DatabaseServer) NewIteratorWithStartAndPrefix(_ context.Context, req *rpcdbpb.NewIteratorWithStartAndPrefixRequest) (*rpcdbpb.NewIteratorWithStartAndPrefixResponse, error)
NewIteratorWithStartAndPrefix allocates an iterator and returns the iterator ID
func (*DatabaseServer) Put ¶
func (db *DatabaseServer) Put(_ context.Context, req *rpcdbpb.PutRequest) (*rpcdbpb.PutResponse, error)
Put delegates the Put call to the managed database and returns the result
func (*DatabaseServer) WriteBatch ¶
func (db *DatabaseServer) WriteBatch(_ context.Context, req *rpcdbpb.WriteBatchRequest) (*rpcdbpb.WriteBatchResponse, error)
WriteBatch takes in a set of key-value pairs and atomically writes them to the internal database