polygoncommon

package
v3.0.0-alpha5.0...-c974331 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

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 AsDatabase(db kv.RoDB) *Database

func NewDatabase

func NewDatabase(dataDir string, label kv.Label, tableCfg kv.TableCfg, logger log.Logger, accede bool, roTxLimit int64) *Database

func (*Database) BeginRo

func (db *Database) BeginRo(ctx context.Context) (kv.Tx, error)

func (*Database) BeginRw

func (db *Database) BeginRw(ctx context.Context) (kv.RwTx, error)

func (*Database) Close

func (db *Database) Close()

func (*Database) OpenOnce

func (db *Database) OpenOnce(ctx context.Context) error

func (*Database) RoDB

func (db *Database) RoDB() kv.RoDB

func (*Database) RwDB

func (db *Database) RwDB() kv.RwDB

func (*Database) View

func (db *Database) View(ctx context.Context, f func(tx kv.Tx) error) error

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) Reset

func (en *EventNotifier) Reset()

Reset to the "non-signaled" state.

func (*EventNotifier) SetAndBroadcast

func (en *EventNotifier) SetAndBroadcast()

SetAndBroadcast sets the "signaled" state and notifies all waiters.

func (*EventNotifier) Wait

func (en *EventNotifier) Wait(ctx context.Context) error

Wait for the "signaled" state. If the event is already "signaled" it returns immediately.

type Observer

type Observer[TEvent any] func(event TEvent)

type Observers

type Observers[TEvent any] struct {
	// contains filtered or unexported fields
}

func NewObservers

func NewObservers[TEvent any]() *Observers[TEvent]

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()

Jump to

Keyboard shortcuts

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