Documentation
¶
Index ¶
- func CheckExpiration(ev *event.E) (expired bool)
- func CreateIdHashFromData(data []byte) (i *types2.IdHash, err error)
- func CreatePubHashFromData(data []byte) (p *types2.PubHash, err error)
- func GetIndexesForEvent(ev *event.E, serial uint64) (idxs [][]byte, err error)
- func IsHexString(data []byte) (isHex bool)
- func NewLogger(logLevel int, label string) (l *logger)
- type D
- func (d *D) Close() (err error)
- func (d *D) DeleteEvent(c context.T, eid *eventid.T) (err error)
- func (d *D) DeleteEventBySerial(c context.T, ser *types.Uint40, ev *event.E) (err error)
- func (d *D) DeleteExpired()
- func (d *D) EventIdsBySerial(start uint64, count int) (evs []eventidserial.E, err error)
- func (d *D) Export(c context.T, w io.Writer, pubkeys ...[]byte)
- func (d *D) FetchEventBySerial(ser *types.Uint40) (ev *event.E, err error)
- func (d *D) GetFullIdPubkeyBySerial(ser *types.Uint40) (fidpk *store.IdPkTs, err error)
- func (d *D) GetFullIdPubkeyBySerials(sers []*types.Uint40) (fidpks []*store.IdPkTs, err error)
- func (d *D) GetSerialById(id []byte) (ser *types.Uint40, err error)
- func (d *D) GetSerialsByRange(idx Range) (sers types.Uint40s, err error)
- func (d *D) Import(rr io.Reader)
- func (d *D) Init(path string) (err error)
- func (d *D) Path() string
- func (d *D) QueryEvents(c context.T, f *filter.F) (evs event.S, err error)
- func (d *D) QueryForIds(c context.T, f *filter.F) (idPkTs []*store.IdPkTs, err error)
- func (d *D) QueryForSerials(c context.T, f *filter.F) (sers types.Uint40s, err error)
- func (d *D) RunMigrations()
- func (d *D) SaveEvent(c context.T, ev *event.E, noVerify bool, owners [][]byte) (kc, vc int, err error)
- func (d *D) SetLogLevel(level string)
- func (d *D) Sync() (err error)
- func (d *D) UpdateExpirationTags()
- func (d *D) Wipe() (err error)
- type Range
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckExpiration ¶ added in v0.7.0
func CreateIdHashFromData ¶
CreateIdHashFromData creates an IdHash from data that could be hex or binary
func CreatePubHashFromData ¶
CreatePubHashFromData creates a PubHash from data that could be hex or binary
func GetIndexesForEvent ¶
GetIndexesForEvent creates all the indexes for an event.E instance as defined in keys.go. It returns a slice of byte slices that can be used to store the event in the database.
func IsHexString ¶
IsHexString checks if the byte slice contains only hex characters
Types ¶
type D ¶
func (*D) DeleteEvent ¶
DeleteEvent removes an event from the database identified by `eid`. If noTombstone is false or not provided, a tombstone is created for the event.
func (*D) DeleteEventBySerial ¶ added in v0.7.0
func (*D) DeleteExpired ¶ added in v0.7.0
func (d *D) DeleteExpired()
func (*D) EventIdsBySerial ¶
func (*D) Export ¶
Export the complete database of stored events to an io.Writer in line structured minified JSON.
func (*D) FetchEventBySerial ¶
func (*D) GetFullIdPubkeyBySerial ¶
func (*D) GetFullIdPubkeyBySerials ¶ added in v0.8.1
GetFullIdPubkeyBySerials seeks directly to each serial's prefix in the FullIdPubkey index. The input sers slice is expected to be sorted in ascending order, allowing efficient forward-only iteration via a single Badger iterator.
func (*D) GetSerialsByRange ¶
func (*D) QueryForIds ¶
QueryForIds retrieves a list of IdPkTs based on the provided filter. It supports filtering by ranges and tags but disallows filtering by Ids. Results are sorted by timestamp in reverse chronological order. Returns an error if the filter contains Ids or if any operation fails.
func (*D) QueryForSerials ¶
QueryForSerials takes a filter and returns the serials of events that match, sorted in reverse chronological order.
func (*D) RunMigrations ¶ added in v0.7.0
func (d *D) RunMigrations()
func (*D) SaveEvent ¶
func (d *D) SaveEvent( c context.T, ev *event.E, noVerify bool, owners [][]byte, ) (kc, vc int, err error)
SaveEvent saves an event to the database, generating all the necessary indexes.
func (*D) SetLogLevel ¶
func (*D) UpdateExpirationTags ¶ added in v0.7.0
func (d *D) UpdateExpirationTags()
type Range ¶
type Range struct {
Start, End []byte
}
func GetIndexesFromFilter ¶
GetIndexesFromFilter returns encoded indexes based on the given filter.
An error is returned if any input values are invalid during encoding.
The indexes are designed so that only one table needs to be iterated, being a complete set of combinations of all fields in the event, thus there is no need to decode events until they are to be delivered.
Source Files
¶
- database.go
- delete-event.go
- delete-expired.go
- export.go
- fetch-event-by-serial.go
- get-fullidpubkey-by-serial.go
- get-fullidpubkey-by-serials.go
- get-indexes-for-event.go
- get-indexes-from-filter.go
- get-serial-by-id.go
- get-serials-by-range.go
- import.go
- logger.go
- migrations.go
- query-events.go
- query-for-ids.go
- query-for-serials.go
- save-event.go