store

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: Unlicense Imports: 13 Imported by: 0

Documentation

Overview

Package store is an interface and ancillary helpers and types for defining a series of API elements for abstracting the event storage from the implementation.

It is composed so that the top-level interface can be partially implemented if need be.

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

This section is empty.

Types

type Accountant

type Accountant interface {
	EventCount() (count uint64, err error)
}

type Configuration

type Configuration struct {
	BlockList []string `json:"block_list" doc:"list of IP addresses that will be ignored"`
}

type Configurationer

type Configurationer interface {
	GetConfiguration() (c config.C, err error)
	SetConfiguration(c config.C) (err error)
}

type Deleter

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

type EventIdSerialer

type EventIdSerialer interface {
	EventIdsBySerial(start uint64, count int) (
		evs []eventidserial.E,
		err error,
	)
}

type Exporter

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 context.T, w io.Writer, pubkeys ...[]byte)
}

type GetIdsWriter

type GetIdsWriter interface {
	FetchIds(c context.T, evIds *tag.T, out io.Writer) (err error)
}

type I

I am a type for a persistence layer for nostr events handled by a relay.

type IdPkTs

type IdPkTs struct {
	Id  []byte
	Pub []byte
	Ts  int64
	Ser uint64
}

type Importer

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

type Initer

type Initer interface {
	Init(path string) (err error)
}

type LogLeveler

type LogLeveler interface {
	SetLogLevel(level string)
}

type OK

type OK = okenvelope.T

type Pather

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

type Querent

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 context.T, f *filter.F) (evs event.S, err error)
}

type Querier

type Querier interface {
	QueryForIds(c context.T, f *filter.F) (evs []*IdPkTs, err error)
}

type Req

type Req = *http.Request

type Rescanner

type Rescanner interface {
	// Rescan triggers the regeneration of indexes of the database to enable old
	// records to be found with new indexes.
	Rescan() (err error)
}

type Responder

type Responder = http.ResponseWriter

type Saver

type Saver interface {
	// SaveEvent is called once relay.AcceptEvent reports true. The owners
	// parameter is for designating admins whose delete by e tag events apply
	// the same as author's own.
	SaveEvent(
		c context.T, ev *event.E, noVerify bool, owners [][]byte,
	) (kc, vc int, err error)
}

type SerialByIder added in v0.2.13

type SerialByIder interface {
	GetSerialById(id []byte) (ser *types.Uint40, err error)
}

type SubID

type SubID = subscription.Id

type Syncer

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

type Wiper

type Wiper interface {
	// Wipe deletes everything in the database.
	Wipe() (err error)
}

Jump to

Keyboard shortcuts

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