Documentation ¶
Index ¶
- Constants
- func SeekCursor(pageSize int32, nextKey []byte, namespace string) (string, error)
- type BackupManager
- type ContextKey
- type PeerInfo
- type PeerService
- func (p *PeerService) AddPeers(ctx context.Context, in *peers.Peer) (out *peers.PeersStatus, err error)
- func (p *PeerService) GetPeers(ctx context.Context, in *peers.PeersFilter) (out *peers.PeersList, err error)
- func (p *PeerService) RmPeers(ctx context.Context, in *peers.Peer) (out *peers.PeersStatus, err error)
- type Server
- type TrtlService
- func (h *TrtlService) Batch(stream pb.Trtl_BatchServer) error
- func (h *TrtlService) Cursor(in *pb.CursorRequest, stream pb.Trtl_CursorServer) (err error)
- func (h *TrtlService) Delete(ctx context.Context, in *pb.DeleteRequest) (out *pb.DeleteReply, err error)
- func (h *TrtlService) Get(ctx context.Context, in *pb.GetRequest) (_ *pb.GetReply, err error)
- func (h *TrtlService) Iter(ctx context.Context, in *pb.IterRequest) (out *pb.IterReply, err error)
- func (h *TrtlService) Put(ctx context.Context, in *pb.PutRequest) (out *pb.PutReply, err error)
- func (h *TrtlService) Status(ctx context.Context, in *pb.HealthCheck) (out *pb.ServerStatus, err error)
- func (h *TrtlService) Sync(stream pb.Trtl_SyncServer) (err error)
Constants ¶
const ( NamespacePeers = wire.NamespaceReplicas NamespaceIndex = wire.NamespaceIndices NamespaceDefault = "default" NamespaceSequence = wire.NamespaceSequence NamespaceVASPs = wire.NamespaceVASPs NamespaceCertReqs = wire.NamespaceCertReqs )
Variables ¶
This section is empty.
Functions ¶
func SeekCursor ¶ added in v1.3.1
SeekCursor returns a next page token that will cause the iter method to start pagination at the specified key. This is a hack to support the Seek() method in the trtl store iterator interface. In the future, the Iter method should be able to seek via an RPC.
Types ¶
type BackupManager ¶ added in v1.3.1
type BackupManager struct {
// contains filtered or unexported fields
}
BackupManager runs as an independent service which periodically copies the trtl storage to a compressed backup location on disk. The backup manager is started when the trtl service is started, but if it is not able to run it will force the database to exit before continuing.
TODO: allow storage to cloud storage rather than to disk TODO: encrypt the backup storage file
func NewBackupManager ¶ added in v1.3.1
func NewBackupManager(conf config.BackupConfig, db *honu.DB) (*BackupManager, error)
func (*BackupManager) Run ¶ added in v1.3.1
func (m *BackupManager) Run()
Runs the main BackupManager routine which periodically wakes up and creates a backup of the trtl database.
func (*BackupManager) Shutdown ¶ added in v1.3.1
func (m *BackupManager) Shutdown() error
type ContextKey ¶
type ContextKey string
type PeerService ¶
type PeerService struct { peers.UnimplementedPeerManagementServer // contains filtered or unexported fields }
A PeerService implements the RPCs for managing remote peers.
func NewPeerService ¶
func NewPeerService(s *Server) (*PeerService, error)
func (*PeerService) AddPeers ¶
func (p *PeerService) AddPeers(ctx context.Context, in *peers.Peer) (out *peers.PeersStatus, err error)
AddPeers adds a peer and returns a report of the status of all peers in the network.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
A Trtl server implements the following services 1. A database service for interacting with a database 2. A peers management service for interacting with remote peers 3. A replication service which implements auto-adapting anti-entropy replication.
func (*Server) Run ¶
Run the gRPC server. This method is extracted from the Serve function so that it can be run in its own go routine and to allow tests to Run a bufconn server without starting a live server with all of the various go routines and channels running.
type TrtlService ¶
type TrtlService struct { pb.UnimplementedTrtlServer // contains filtered or unexported fields }
A TrtlService implements the RPCs for interacting with a Honu database.
func NewTrtlService ¶
func NewTrtlService(s *Server) (*TrtlService, error)
func (*TrtlService) Batch ¶
func (h *TrtlService) Batch(stream pb.Trtl_BatchServer) error
Batch is a client-side streaming request to issue multiple commands, usually Put and Delete.
func (*TrtlService) Cursor ¶
func (h *TrtlService) Cursor(in *pb.CursorRequest, stream pb.Trtl_CursorServer) (err error)
Cursor is a server-side streaming request to fetch a collection of key/value pairs based on a shared prefix. If no prefix is specified an entire namespace may be returned. The pairs are streamed one value at a time so that the client can control iteration and materialization without overloading either the server or the network.
Note that there is a snapshot guarantee during iteration, meaning that if the underlying database changes via a concurrent request, the cursor stream will not be effected. Use Cursor instead of Iter if you require snapshot isolation reads.
There are several options that modulate the Cursor stream:
- return_meta: each key/value pair will contain the object metadata
- iter_no_keys: each key/value pair will not have a key associated with it
- iter_no_values: each key/value pair will not have a value associated with it
- page_token: the page of results that the user wishes to fetch
- page_size: the number of results to be returned in the request
func (*TrtlService) Delete ¶
func (h *TrtlService) Delete(ctx context.Context, in *pb.DeleteRequest) (out *pb.DeleteReply, err error)
Delete is a unary request to delete a key. If a namespace is provided, the namespace is passed to the internal honu Options, to delete the key from a specific namespace. Note that this does not delete tombstones.
func (*TrtlService) Get ¶
func (h *TrtlService) Get(ctx context.Context, in *pb.GetRequest) (_ *pb.GetReply, err error)
Get is a unary request to retrieve a value for a key. If metadata is requested in the GetRequest, the request will use honu.Object() to retrieve the entire object, including the metadata. If no metadata is requested, the request will use honu.Get() to get only the value. If a namespace is provided, the namespace is passed to the internal honu Options, to look in that namespace only.
func (*TrtlService) Iter ¶
func (h *TrtlService) Iter(ctx context.Context, in *pb.IterRequest) (out *pb.IterReply, err error)
Iter is a unary request to fetch a materialized collection of key/value pairs based on a shared prefix. If no prefix is specified an entire namespace may be returned. This RPC supports pagination to ensure that replies do not get too large. The default page size is 100 items, though this can be modified in the options. The next page token in the result will contain the next page to request, or will be empty if there are no more results to be supplied.
Note that there are no snapshot guarantees during iteration, meaning that if the underlying database changes between requests, these changes could be reflected during iteration. For snapshot isolation in iteration, use the Cursor RPC.
There are several options that modulate the Iter response:
- return_meta: each key/value pair will contain the object metadata
- iter_no_keys: each key/value pair will not have a key associated with it
- iter_no_values: each key/value pair will not have a value associated with it
- page_token: the page of results that the user wishes to fetch
- page_size: the number of results to be returned in the request
func (*TrtlService) Put ¶
func (h *TrtlService) Put(ctx context.Context, in *pb.PutRequest) (out *pb.PutReply, err error)
Put is a unary request to store a value for a key. If a namespace is provided, the namespace is passed to the internal honu Options, to put the value to that namespace.
func (*TrtlService) Status ¶ added in v1.3.1
func (h *TrtlService) Status(ctx context.Context, in *pb.HealthCheck) (out *pb.ServerStatus, err error)
func (*TrtlService) Sync ¶
func (h *TrtlService) Sync(stream pb.Trtl_SyncServer) (err error)
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package jitter provides a stochastic ticker that returns ticks at a random interval specified by a normal distribution with a mean periodicity and a standard deviation, sigma both of which are time.Durations.
|
Package jitter provides a stochastic ticker that returns ticks at a random interval specified by a normal distribution with a mean periodicity and a standard deviation, sigma both of which are time.Durations. |
pb
|
|
peers
|
|
Package replica implements bilateral anti-entropy replication for the trtl database.
|
Package replica implements bilateral anti-entropy replication for the trtl database. |