Documentation ¶
Index ¶
- func VerifyRequest(m *ccmsg.ClientCacheRequest) error
- type Application
- type Cache
- func (c *Cache) AddEscrowToDatabase(ctx context.Context, escrow *Escrow) error
- func (c *Cache) Close() error
- func (c *Cache) HandleRequest(ctx context.Context, req *ccmsg.ClientCacheRequest) (*ccmsg.ClientCacheResponse, error)
- func (c *Cache) LoadFromDatabase(ctx context.Context) (int, error)
- func (c *Cache) OfferEscrow(ctx context.Context, req *ccmsg.EscrowOfferRequest) (*ccmsg.EscrowOfferResponse, error)
- type CacheStorage
- func (s *CacheStorage) Close() error
- func (s *CacheStorage) DeleteData(escrowID common.EscrowID, chunkID common.ChunkID) error
- func (s *CacheStorage) DeleteRawBytes(key []byte) error
- func (s *CacheStorage) GetData(escrowID common.EscrowID, chunkID common.ChunkID) ([]byte, error)
- func (s *CacheStorage) GetMetadata(escrowID common.EscrowID, objectID common.ObjectID) (*ccmsg.ObjectMetadata, error)
- func (s *CacheStorage) GetRawBytes(key []byte) ([]byte, error)
- func (s *CacheStorage) PutData(escrowID common.EscrowID, chunkID common.ChunkID, data []byte) error
- func (s *CacheStorage) PutMetadata(escrowID common.EscrowID, objectID common.ObjectID, m *ccmsg.ObjectMetadata) error
- func (s *CacheStorage) PutRawBytes(key []byte, bytes []byte) error
- type ConfigFile
- type Escrow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VerifyRequest ¶
func VerifyRequest(m *ccmsg.ClientCacheRequest) error
TODO: This should go somewhere non-cache-specific; initially, it was in ccmsg, but that created an import cycle.
N.B.: This does *not* consider anything about who has generated the batch signature; at present, it just checks that the data-carrying parts of the message are (indirectly) covered by that signature.
Types ¶
type Application ¶
type Application interface { common.StarterShutdowner }
An Application is the top-level content publisher. It takes a configuration struct. Its children are the several protocol servers (that deal with clients, caches, and so forth).
func NewApplication ¶
func NewApplication(l *logrus.Logger, c *Cache, db *sql.DB, conf *ConfigFile, kp *keypair.KeyPair, r *ledgerclient.Replicator) (Application, error)
type Cache ¶
type Cache struct { PublicKey ed25519.PublicKey Escrows map[common.EscrowID]*Escrow Storage *CacheStorage StoragePath string StartupTime time.Time Config *ConfigFile // contains filtered or unexported fields }
func (*Cache) AddEscrowToDatabase ¶
func (*Cache) HandleRequest ¶
func (c *Cache) HandleRequest(ctx context.Context, req *ccmsg.ClientCacheRequest) (*ccmsg.ClientCacheResponse, error)
func (*Cache) OfferEscrow ¶
func (c *Cache) OfferEscrow(ctx context.Context, req *ccmsg.EscrowOfferRequest) (*ccmsg.EscrowOfferResponse, error)
type CacheStorage ¶
type CacheStorage struct {
// contains filtered or unexported fields
}
func NewCacheStorage ¶
func NewCacheStorage(l *logrus.Logger, badgerDirectory string) (*CacheStorage, error)
func (*CacheStorage) Close ¶
func (s *CacheStorage) Close() error
func (*CacheStorage) DeleteData ¶
func (*CacheStorage) DeleteRawBytes ¶
func (s *CacheStorage) DeleteRawBytes(key []byte) error
func (*CacheStorage) GetMetadata ¶
func (s *CacheStorage) GetMetadata(escrowID common.EscrowID, objectID common.ObjectID) (*ccmsg.ObjectMetadata, error)
Returns (nil, nil) if the object does not exist; the error part of the rval is reserved for e.g. storage engine errors.
func (*CacheStorage) GetRawBytes ¶
func (s *CacheStorage) GetRawBytes(key []byte) ([]byte, error)
func (*CacheStorage) PutMetadata ¶
func (s *CacheStorage) PutMetadata(escrowID common.EscrowID, objectID common.ObjectID, m *ccmsg.ObjectMetadata) error
func (*CacheStorage) PutRawBytes ¶
func (s *CacheStorage) PutRawBytes(key []byte, bytes []byte) error
type ConfigFile ¶
type ConfigFile struct { ClientProtocolGrpcAddr string ClientProtocolHttpAddr string StatusAddr string BootstrapAddr string LedgerAddr string BadgerDirectory string `json:"badger_directory"` Database string `json:"database"` ContactUrl string `json:"contact_url"` MetricsEndpoint string `json:"metrics_endpoint"` SyncInterval time.Duration `json:"sync_interval"` Insecure bool `json:"insecure"` }
type Escrow ¶
func (*Escrow) InnerMasterKey ¶
func (*Escrow) OuterMasterKey ¶
func (*Escrow) PublisherAddr ¶
Click to show internal directories.
Click to hide internal directories.