IC

package
v1.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2024 License: GPL-2.0, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBackend

func GetBackend(c context.T, wg *sync.WaitGroup, L1 *badger.Backend,
	L2 *IConly.Backend) (es eventstore.Store)

GetBackend returns a l2.Backend that combines the two provided backends. It is assumed both were

Types

type Backend

type Backend struct {
	*l2.Backend
}

Backend is a hybrid badger/Internet Computer based event store.

All search indexes are retained even if event data is pruned to reduce storage space for the relay, when events are pruned, their data is replaced with the event ID to signify they must be fetched and restored to the raw event key.

An alternative data store could be created that purely relies on the IC, or alternatively prunes search indexes to minimize storage used by pruned events, but these would be slower at retrieval and require a more complex cache algorithm.

func (*Backend) Close

func (b *Backend) Close()

Close the connection to the database. IC is a request/response API authing at each request.

func (*Backend) CountEvents

func (b *Backend) CountEvents(c context.T, f *filter.T) (count int, err error)

CountEvents returns the number of events found matching the filter.

func (*Backend) DeleteEvent

func (b *Backend) DeleteEvent(c context.T, ev *event.T) (err error)

DeleteEvent removes an event from the event store.

func (*Backend) Init

func (b *Backend) Init() (err error)

Init sets up the badger event store and connects to the configured IC canister.

required params are address, canister ID and the badger event store size limit (which can be 0)

func (*Backend) QueryEvents

func (b *Backend) QueryEvents(c context.T, f *filter.T) (ch event.C, err error)

QueryEvents searches for events that match a filter and returns them asynchronously over a provided channel.

func (*Backend) SaveEvent

func (b *Backend) SaveEvent(c context.T, ev *event.T) (err error)

SaveEvent writes an event to the event store.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL