store

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: Unlicense Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDupEvent       = errors.New("duplicate: event already exists")
	ErrEventNotExists = errors.New("unknown: event not known by any source of this realy")
)

Functions

func GetAddrTagElements

func GetAddrTagElements(tagValue st) (k uint16, pkb by, d st)

func Less

func Less(a, b tag.T) bo

func TagSorter

func TagSorter(a, b tag.T) no

Types

type Counter added in v1.5.2

type Counter interface {
	// CountEvents performs the same work as QueryEvents but instead of delivering
	// the events that were found it just returns the count of events
	CountEvents(c cx, f *filter.T) (count no, approx bo, err er)
}

type Deleter added in v1.5.2

type Deleter interface {
	// DeleteEvent is used to handle deletion events, as per NIP-09.
	DeleteEvent(c cx, ev *eventid.T, noTombstone ...bo) (err er)
}

type Exporter added in v1.5.2

type Exporter interface {
	// Export writes a stream of line structured JSON of all events in the store. If
	// pubkeys are present, only those with these pubkeys in the `pubkey` field and
	// in `p` tags will be included.
	Export(c cx, w io.Writer, pubkeys ...by)
}

type I

I is an types for a persistence layer for nostr events handled by a relay.

type Importer added in v1.5.2

type Importer interface {
	// Import reads in a stream of line structured JSON of events to save into the
	// store.
	Import(r io.Reader)
}

type Initer added in v1.7.2

type Initer interface {
	// Init is called at the very beginning by [Server.Start], after [Relay.Init],
	// allowing a storage to initialize its internal resources. The parameters can be
	// used by the database implementations to set custom parameters such as cache
	// management and other relevant parameters to the specific implementation.
	Init(path st) (err er)
}

type Nuker added in v1.7.2

type Nuker interface {
	// Nuke deletes everything in the database.
	Nuke() (err er)
}

type OK

type OK = okenvelope.T

type Pather added in v1.5.2

type Pather interface {
	// Path returns the directory of the database.
	Path() (s st)
}

type Querent added in v1.5.2

type Querent interface {
	// QueryEvents is invoked upon a client's REQ as described in NIP-01. It returns
	// the matching events in reverse chronological order in a slice.
	QueryEvents(c cx, f *filter.T) (evs event.Ts, err er)
}

type Req

type Req = *http.Request

type Responder

type Responder = http.ResponseWriter

type Saver added in v1.5.2

type Saver interface {
	// SaveEvent is called once Relay.AcceptEvent reports true.
	SaveEvent(c cx, ev *event.T) (err er)
}

type SubID

type SubID = subscription.Id

type Syncer added in v1.5.2

type Syncer interface {
	// Sync signals the event store to flush its buffers.
	Sync() (err er)
}

type WS

type WS = *ws.Serv

Jump to

Keyboard shortcuts

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