Documentation ¶
Overview ¶
Package l2 is a testing data store that implements a level 2 cache for events with a badger eventstore.
This is a testing environment for building cache strategies.
Index ¶
- type Backend
- func (b *Backend) Close()
- func (b *Backend) CountEvents(c context.T, f *filter.T) (count int, err error)
- func (b *Backend) DeleteEvent(c context.T, ev *event.T) (err error)
- func (b *Backend) Init() (err error)
- func (b *Backend) QueryEvents(c context.T, f *filter.T) (ch event.C, err error)
- func (b *Backend) Revive(ev1 *event.T, c context.T, ch, saveChan event.C)
- func (b *Backend) SaveEvent(c context.T, ev *event.T) (err error)
- func (b *Backend) SaveLoop(c context.T, saveChan event.C)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct { Ctx context.T // L1 is a primary, presumably local store, which should be faster, but may be // space constrained. L1 *badger.Backend // L2 is a secondary, possibly slower but bigger cache. It could be an IC // canister, an IPFS based store with an indexing spider or indeed a giant // spinning disk. L2 eventstore.Store }
func (*Backend) CountEvents ¶
func (*Backend) DeleteEvent ¶
DeleteEvent deletes the event if found. If not found, will return eventstore.ErrEventNotExists.
Relay may have filters to block this, by default only an event author can delete an event, but this is not processed here, it must be done in a previous step.
func (*Backend) QueryEvents ¶
func (*Backend) SaveEvent ¶
SaveEvent stores the event to the local badger store and the L2, and returns any errors from each store. The only error defined here is eventstore.ErrDupEvent if the store already has the event.
Any errors from this method are not fatal, mostly, mostly anything else, like auth- or filter- related denials are from a separate subsystem.