Documentation ¶
Index ¶
- type Database
- func (db *Database) BeginRo(ctx context.Context) (kv.Tx, error)
- func (db *Database) BeginRw(ctx context.Context) (kv.RwTx, error)
- func (db *Database) Close()
- func (db *Database) OpenOnce(ctx context.Context) error
- func (db *Database) RoDB() kv.RoDB
- func (db *Database) RwDB() kv.RwDB
- func (db *Database) View(ctx context.Context, f func(tx kv.Tx) error) error
- type EventNotifier
- type Observer
- type Observers
- type UnregisterFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func AsDatabase ¶
func NewDatabase ¶
type EventNotifier ¶
type EventNotifier struct {
// contains filtered or unexported fields
}
EventNotifier notifies waiters about an event. It supports a single "producer" and multiple waiters. A producer can set the event state to "signaled" or "non-signaled". Waiters can wait for the "signaled" event state.
func NewEventNotifier ¶
func NewEventNotifier() *EventNotifier
func (*EventNotifier) SetAndBroadcast ¶
func (en *EventNotifier) SetAndBroadcast()
SetAndBroadcast sets the "signaled" state and notifies all waiters.
type Observers ¶
type Observers[TEvent any] struct { // contains filtered or unexported fields }
func NewObservers ¶
func (*Observers[TEvent]) Close ¶
func (o *Observers[TEvent]) Close()
Close unregisters all observers.
func (*Observers[TEvent]) Notify ¶
func (o *Observers[TEvent]) Notify(event TEvent)
Notify all observers in parallel without waiting for them to process the event.
func (*Observers[TEvent]) NotifySync ¶
func (o *Observers[TEvent]) NotifySync(event TEvent)
NotifySync all observers in parallel and wait until all of them process the event.
func (*Observers[TEvent]) Register ¶
func (o *Observers[TEvent]) Register(observer Observer[TEvent]) UnregisterFunc
Register an observer. Call the returned function to unregister it.
type UnregisterFunc ¶
type UnregisterFunc func()
Click to show internal directories.
Click to hide internal directories.