Documentation
¶
Overview ¶
Package reqstore is an implementation of the RequestStore utilized by the samples. Depending on your application, it may or may not be appropriate. In particular, if your application wants to retain the requests rather than simply apply and discard them, you may wish to write your own or adapt this one.
Index ¶
- type Store
- func (s *Store) Close()
- func (s *Store) Commit(ack *requestpb.RequestRef) error
- func (s *Store) GetAllocation(clientID t.ClientID, reqNo t.ReqNo) ([]byte, error)
- func (s *Store) GetRequest(requestRef *requestpb.RequestRef) ([]byte, error)
- func (s *Store) PutAllocation(clientID t.ClientID, reqNo t.ReqNo, digest []byte) error
- func (s *Store) PutRequest(requestRef *requestpb.RequestRef, data []byte) error
- func (s *Store) Sync() error
- type VolatileRequestStore
- func (vrs *VolatileRequestStore) GetAuthenticator(reqRef *requestpb.RequestRef) ([]byte, error)
- func (vrs *VolatileRequestStore) GetDigestsByID(clientId t.ClientID, reqNo t.ReqNo) ([][]byte, error)
- func (vrs *VolatileRequestStore) GetRequest(reqRef *requestpb.RequestRef) ([]byte, error)
- func (vrs *VolatileRequestStore) IsAuthenticated(reqRef *requestpb.RequestRef) (bool, error)
- func (vrs *VolatileRequestStore) PutAuthenticator(reqRef *requestpb.RequestRef, auth []byte) error
- func (vrs *VolatileRequestStore) PutRequest(reqRef *requestpb.RequestRef, data []byte) error
- func (vrs *VolatileRequestStore) SetAuthenticated(reqRef *requestpb.RequestRef) error
- func (vrs *VolatileRequestStore) Sync() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) GetAllocation ¶
func (*Store) GetRequest ¶
func (s *Store) GetRequest(requestRef *requestpb.RequestRef) ([]byte, error)
func (*Store) PutAllocation ¶
func (*Store) PutRequest ¶
func (s *Store) PutRequest(requestRef *requestpb.RequestRef, data []byte) error
type VolatileRequestStore ¶
type VolatileRequestStore struct {
// contains filtered or unexported fields
}
VolatileRequestStore is an in-memory implementation of modules.RequestStore. All data is stored in RAM and the Sync() method does nothing. TODO: implement pruning of old data.
func NewVolatileRequestStore ¶
func NewVolatileRequestStore() *VolatileRequestStore
func (*VolatileRequestStore) GetAuthenticator ¶
func (vrs *VolatileRequestStore) GetAuthenticator(reqRef *requestpb.RequestRef) ([]byte, error)
GetAuthenticator returns the stored authenticator associated with the passed request reference. If no authenticator is stored under the given reference, the returned error will be non-nil.
func (*VolatileRequestStore) GetDigestsByID ¶
func (vrs *VolatileRequestStore) GetDigestsByID(clientId t.ClientID, reqNo t.ReqNo) ([][]byte, error)
GetDigestsByID returns a list of request digests for which any information (request data, authentication, or authenticator) is stored in the RequestStore.
func (*VolatileRequestStore) GetRequest ¶
func (vrs *VolatileRequestStore) GetRequest(reqRef *requestpb.RequestRef) ([]byte, error)
GetRequest returns the stored request data associated with the passed request reference. If no data is stored under the given reference, the returned error will be non-nil.
func (*VolatileRequestStore) IsAuthenticated ¶
func (vrs *VolatileRequestStore) IsAuthenticated(reqRef *requestpb.RequestRef) (bool, error)
IsAuthenticated returns true if the request is authenticated, false otherwise.
func (*VolatileRequestStore) PutAuthenticator ¶
func (vrs *VolatileRequestStore) PutAuthenticator(reqRef *requestpb.RequestRef, auth []byte) error
PutAuthenticator stores an authenticator associated with the referenced request. If an authenticator is already stored under the same reference, it will be overwritten.
func (*VolatileRequestStore) PutRequest ¶
func (vrs *VolatileRequestStore) PutRequest(reqRef *requestpb.RequestRef, data []byte) error
PutRequest stores request the passed request data associated with the request reference.
func (*VolatileRequestStore) SetAuthenticated ¶
func (vrs *VolatileRequestStore) SetAuthenticated(reqRef *requestpb.RequestRef) error
SetAuthenticated marks the referenced request as authenticated. A request being authenticated means that the local node believes that the request has indeed been sent by the client. This does not necessarily mean, however, that the local node can convince other nodes about the request's authenticity (e.g. if the local node received the request over an authenticated channel but the request is not signed).
func (*VolatileRequestStore) Sync ¶
func (vrs *VolatileRequestStore) Sync() error
Sync does nothing in this volatile (in-memory) RequestStore implementation.