const (
ClazzKey = "clazz"
)
func ProjectedFieldsToProtos(objectProjectedFields map[shared.ProjectedFieldKey]*shared.ProjectedFieldValue) ([]*projectp.ProjectedField, error)
type Client interface { CatchUpLsqt(shared.Tt, time.Duration) (shared.Lsqt, error) CommitTxn(Txn) (*cshared.WrittenTransaction, error) CommitTxnAsync(Txn) chan cshared.WriteAsyncResponse Context() context.Context Delete(context.Context, shared.ObjectId, shared.Tt, shared.Vt) (*cshared.WrittenObject, error) DeleteAsync(context.Context, shared.ObjectId, shared.Tt, shared.Vt) chan cshared.WriteAsyncResponse DeleteObject(context.Context, Indexable, shared.Vt) (*cshared.WrittenObject, error) DeleteObjectAsync(context.Context, Indexable, shared.Vt) chan cshared.WriteAsyncResponse Lsqt() shared.Lsqt Put(context.Context, shared.ObjectId, shared.Tt, shared.Vt, *shared.Blob) (*cshared.WrittenObject, error) PutAsync(context.Context, shared.ObjectId, shared.Tt, shared.Vt, *shared.Blob) chan cshared.WriteAsyncResponse PutObject(context.Context, Indexable, shared.Tt, shared.Vt) (*cshared.WrittenObject, error) PutObjectAsync(context.Context, Indexable, shared.Tt, shared.Vt) chan cshared.WriteAsyncResponse ReadEvent(context.Context, shared.EventId, shared.Fqn, shared.Tt) (shared.Event, error) ReadEventAsync(context.Context, shared.EventId, shared.Fqn, shared.Tt) chan cshared.ReadAsyncResponse ReadEventForObject(context.Context, Indexable) (shared.Event, error) ReadEventForObjectAsync(context.Context, Indexable) chan cshared.ReadAsyncResponse ReadObject(context.Context, Indexable, *shared.TemporalCoordinates) (*cshared.ReadObject, error) ReadObjectAsync(context.Context, Indexable, *shared.TemporalCoordinates) chan cshared.ReadObject ReadObjects(context.Context, Indexable, *shared.TemporalCoordinates) ([]Indexable, error) ReadObjectsAsync(context.Context, Indexable, *shared.TemporalCoordinates) chan cshared.ReadAsyncResponse ReadObjectsByEvent(context.Context, shared.Event) ([]Indexable, error) ReadObjectsByEventAsync(context.Context, shared.Event) chan Indexable // No async version for this because it powers an Iterator. ReadObjectsByFqn(context.Context, shared.Fqn, shared.Tt, shared.TimesliceId, shared.Tt, shared.BatchSize) ([]Indexable, error) ReadObjectsByIndexedQuery(context.Context, *IndexedQuery, *shared.TemporalCoordinates) ([]Indexable, error) ReadObjectsByIndexedQueryAsync(context.Context, *IndexedQuery, *shared.TemporalCoordinates) chan cshared.ReadAsyncResponse ReadObjectsToIndexables([]*cshared.ReadObject) ([]Indexable, error) ReadPoint(context.Context, shared.ObjectId, *shared.TemporalCoordinates) (*cshared.ReadObject, error) ReadPointAsync(context.Context, shared.ObjectId, *shared.TemporalCoordinates) chan cshared.ReadAsyncResponse Reinstate(context.Context, shared.ObjectId, shared.Tt, shared.Vt) (*cshared.WrittenObject, error) ReinstateAsync(context.Context, shared.ObjectId, shared.Tt, shared.Vt) chan cshared.WriteAsyncResponse ReinstateObject(context.Context, Indexable, shared.Tt, shared.Vt) (*cshared.WrittenObject, error) ReinstateObjectAsync(context.Context, Indexable, shared.Tt, shared.Vt) chan cshared.WriteAsyncResponse Start() // Aggregations CountByIndexedQuery(*IndexedQuery, *shared.TemporalCoordinates) (*big.Int, bool, error) CountByIndexedQueryAsync(*IndexedQuery, *shared.TemporalCoordinates) chan cshared.ReadAsyncResponse MaxByIndexedQuery(*IndexedQuery, shared.ProjectedFieldKey, *shared.TemporalCoordinates) (*big.Rat, bool, error) MaxByIndexedQueryAsync(*IndexedQuery, shared.ProjectedFieldKey, *shared.TemporalCoordinates) chan cshared.ReadAsyncResponse MeanByIndexedQuery(*IndexedQuery, shared.ProjectedFieldKey, *shared.TemporalCoordinates) (*big.Rat, bool, error) MeanByIndexedQueryAsync(*IndexedQuery, shared.ProjectedFieldKey, *shared.TemporalCoordinates) chan cshared.ReadAsyncResponse MedianByIndexedQuery(*IndexedQuery, shared.ProjectedFieldKey, *shared.TemporalCoordinates) (*big.Rat, bool, error) MedianByIndexedQueryAsync(*IndexedQuery, shared.ProjectedFieldKey, *shared.TemporalCoordinates) chan cshared.ReadAsyncResponse MinByIndexedQuery(*IndexedQuery, shared.ProjectedFieldKey, *shared.TemporalCoordinates) (*big.Rat, bool, error) MinByIndexedQueryAsync(*IndexedQuery, shared.ProjectedFieldKey, *shared.TemporalCoordinates) chan cshared.ReadAsyncResponse PercentileByIndexedQuery(*IndexedQuery, shared.ProjectedFieldKey, shared.Percentile, *shared.TemporalCoordinates) (*big.Rat, bool, error) PercentileByIndexedQueryAsync(*IndexedQuery, shared.ProjectedFieldKey, shared.Percentile, *shared.TemporalCoordinates) chan cshared.ReadAsyncResponse StdevByIndexedQuery(*IndexedQuery, shared.ProjectedFieldKey, *shared.TemporalCoordinates) (*big.Rat, bool, error) StdevByIndexedQueryAsync(*IndexedQuery, shared.ProjectedFieldKey, *shared.TemporalCoordinates) chan cshared.ReadAsyncResponse SumByIndexedQuery(*IndexedQuery, shared.ProjectedFieldKey, *shared.TemporalCoordinates) (*big.Rat, bool, error) SumByIndexedQueryAsync(*IndexedQuery, shared.ProjectedFieldKey, *shared.TemporalCoordinates) chan cshared.ReadAsyncResponse VarByIndexedQuery(*IndexedQuery, shared.ProjectedFieldKey, *shared.TemporalCoordinates) (*big.Rat, bool, error) VarByIndexedQueryAsync(*IndexedQuery, shared.ProjectedFieldKey, *shared.TemporalCoordinates) chan cshared.ReadAsyncResponse // Lock / Unlock Fqns ListLockedFqns(context.Context) ([]shared.Fqn, error) LockFqn(context.Context, shared.Fqn) (shared.Tt, error) UnlockFqn(context.Context, shared.Fqn) (shared.Tt, error) // Reindex ReindexObject(context.Context, Indexable) (*cshared.WrittenObject, error) ReindexObjectAsync(context.Context, Indexable) chan cshared.WriteAsyncResponse // Subscribe SubscribeToIndexedQuery(context.Context, *IndexedQuery) (cshared.SubscriptionId, chan cshared.SubscribeResponse, error) SubscribeToObjectId(context.Context, shared.ObjectId) (cshared.SubscriptionId, chan cshared.SubscribeResponse, error) // Tt timeline ReadObjectsAtVt(context.Context, Indexable, *shared.TemporalCoordinates) ([]Indexable, error) ReadObjectsAtVtAsync(context.Context, Indexable, *shared.TemporalCoordinates) chan cshared.ReadAsyncResponse // Vt timeline ReadObjectsAtTt(context.Context, Indexable, shared.Tt) ([]Indexable, error) ReadObjectsAtTtAsync(context.Context, Indexable, shared.Tt) chan cshared.ReadAsyncResponse // Server status ServerStatus(context.Context, cshared.ServerType) (*cshared.ServerStatus, error) // Reload config ReloadConfig(context.Context) error // Entitlements Entitle(context.Context, shared.EmailAddress, shared.Fqn, cshared.ReadEntitlement, cshared.WriteEntitlement, cshared.EntitleEntitlement, shared.Vt, *shared.BackfillTt) (shared.Tt, error) }
Event is an interface that is used to persist metadata about database events.
type Event interface { Equal(any) bool EventId() shared.EventId SetEventId(shared.EventId) error Tt() shared.Tt SetTt(tt shared.Tt) error }
type EventF struct {
// contains filtered or unexported fields
}
func (e *EventF) Equal(o any) bool
func (ev *EventF) EventId() shared.EventId
func (ev *EventF) SetEventId(eid shared.EventId) error
func (ev *EventF) SetTt(tt shared.Tt) error
func (ev *EventF) Tt() shared.Tt
Indexable is an interface that is used to persist metadata about database objects.
type Indexable interface { BackfillTt() shared.BackfillTt EnsureCanProjectField(string, ProjectOp) EnsureCanQueryField(string) Equal(any) bool Fqn() shared.Fqn IndexedQuery() *IndexedQuery ProjectedFields() map[shared.ProjectedFieldKey]*shared.ProjectedFieldValue LastWrite() shared.Tt ObjectId() shared.ObjectId ResolvedRefs() *sync.Map SetObjectId(shared.ObjectId) error SetBackfillTt(shared.BackfillTt) error SetLastWrite(shared.Tt) error SetTtFrom(shared.Tt) error SetTtTo(shared.Tt) error SetVtFrom(shared.Vt) error SetVtTo(shared.Vt) error TtFrom() shared.Tt TtResolvedAt() shared.Tt SetTtResolvedAt(shared.Tt) error VtResolvedAt() shared.Vt SetVtResolvedAt(shared.Vt) error TimesliceId() shared.TimesliceId SetTimesliceId(shared.TimesliceId) error }
IndexableF provides a base set of fields to make working with structs as database objects easier.
type IndexableF struct {
// contains filtered or unexported fields
}
func (i *IndexableF) BackfillTt() shared.BackfillTt
BackfillTt returns the Tt at which the object was backfilled.
func (i *IndexableF) Equal(o any) bool
func (i *IndexableF) LastWrite() shared.Tt
LastWrite returns the lastWrite.
func (i *IndexableF) ObjectId() shared.ObjectId
ObjectId returns the objectId.
func (i *IndexableF) Refs() *sync.Map
func (i *IndexableF) ResetBackfillTt(bt shared.BackfillTt)
ResetBackfillTt resets the backfillTt. Unlike SetBackfillTt, this will not error if called more than once.
func (i *IndexableF) ResolvedRefs() *sync.Map
func (i *IndexableF) SetBackfillTt(bt shared.BackfillTt) error
SetBackfillTt sets the backfillTt. This will error if called more than once since an object's BackfillTt cannot change.
func (i *IndexableF) SetLastWrite(lw shared.Tt) error
SetLastWrite sets the lastWrite. Unlike the objectId, the lastWrite does change as data is modified, so this can be called more than once.
func (i *IndexableF) SetObjectId(oid shared.ObjectId) error
SetObjectId sets the objectId. This will error if called more than once since an object's ObjectId cannot change.
func (i *IndexableF) SetTimesliceId(tid shared.TimesliceId) error
SetTimesliceId sets the TimesliceId of the object's data. This will error if called more than once since an object's timesliceId cannot change.
func (i *IndexableF) SetTtFrom(tt shared.Tt) error
SetTtFrom sets the ttFrom. This will error if called more than once since an object's TtFrom cannot change.
func (i *IndexableF) SetTtResolvedAt(tt shared.Tt) error
SetTtResolvedAt sets the Tt at which the object was loaded. This will error if called more than once since an object's ttResolvedAt cannot change.
func (i *IndexableF) SetTtTo(tt shared.Tt) error
SetTtTo sets the ttTo. This will error if called more than once since an object's TtTo cannot change.
func (i *IndexableF) SetVtFrom(vt shared.Vt) error
SetVtFrom sets the vtFrom. This will error if called more than once since an object's vtFrom cannot change.
func (i *IndexableF) SetVtResolvedAt(vt shared.Vt) error
SetVtResolvedAt sets the Vt at which the object was loaded. This will error if called more than once since an object's vtResolvedAt cannot change.
func (i *IndexableF) SetVtTo(vt shared.Vt) error
SetVtTo sets the vtFrom. This will error if called more than once since an object's vtFrom cannot change.
func (i *IndexableF) TimesliceId() shared.TimesliceId
TimesliceId returns the TimesliceId of the object's data.
func (i *IndexableF) TtFrom() shared.Tt
TtFrom returns the Tt at which the object was written to the database.
func (i *IndexableF) TtResolvedAt() shared.Tt
TtResolvedAt returns the Tt at which the object was loaded.
func (i *IndexableF) TtTo() shared.Tt
TtTo returns the Tt at which the object becomes invalid because, for example, it was deleted.
func (i *IndexableF) VtFrom() shared.Vt
VtFrom returns the Vt at which the object was written to the database.
func (i *IndexableF) VtResolvedAt() shared.Vt
VtResolvedAt returns the Vt at which the object was loaded.
func (i *IndexableF) VtTo() shared.Vt
VtTo returns the Vt at which the object becomes invalid because, for example, it was deleted.
type IndexedQuery struct {
// contains filtered or unexported fields
}
func NewEmptyIndexedQuery(ixbl Indexable) *IndexedQuery
func (iq *IndexedQuery) Equal(iqOther *IndexedQuery) bool
func (iq *IndexedQuery) Indexes() []*indexp.IndexCondition
func (iq *IndexedQuery) Ixbl() Indexable
func (iq *IndexedQuery) ReadObjects(c Client, tc *shared.TemporalCoordinates) ([]Indexable, error)
func (iq *IndexedQuery) ReadObjectsAsync(c Client, tc *shared.TemporalCoordinates) chan cshared.ReadAsyncResponse
func (iq *IndexedQuery) SetIndexes(indexes []*indexp.IndexCondition)
func (iq *IndexedQuery) WhereEq(field string, value interface{}) *IndexedQuery
FIXME: Write tests for these.
func (iq *IndexedQuery) WhereEqUnique(field string, value interface{}) *IndexedQuery
This is used only internally to set indexes to unique.
func (iq *IndexedQuery) WhereGt(field string, value interface{}) *IndexedQuery
func (iq *IndexedQuery) WhereGte(field string, value interface{}) *IndexedQuery
func (iq *IndexedQuery) WhereLt(field string, value interface{}) *IndexedQuery
func (iq *IndexedQuery) WhereLte(field string, value interface{}) *IndexedQuery
type ObjectIterator[T Indexable] interface { HasNext() (bool, error) Next() (T, error) }
type PlainEvent struct { EventF }
func NewPlainEvent() *PlainEvent
func NewPlainEventWithEventId(eventId shared.EventId) *PlainEvent
func (o *PlainEvent) Blob() (shared.EventBlob, error)
func (o *PlainEvent) Fqn() shared.Fqn
func (o *PlainEvent) GenerateEventId() shared.EventId
func (o *PlainEvent) GetEvent(c Client, eventId shared.EventId) (*PlainEvent, error)
func (o *PlainEvent) GetEventAsync(c Client, eventId shared.EventId) chan *PlainEventAsyncResponse
func (o *PlainEvent) InstantiateEventFromBlob(eb shared.EventBlob, eventId shared.EventId, tt shared.Tt) (*PlainEvent, error)
func (o *PlainEvent) ProjectedFields() map[shared.ProjectedFieldKey]*shared.ProjectedFieldValue
type PlainEventAsyncResponse struct { Event *PlainEvent Error error }
type ProjectOp int8
const ( ProjectOpCount ProjectOp = iota ProjectOpMax ProjectOpMean ProjectOpMedian ProjectOpMin ProjectOpPercentile ProjectOpStdev ProjectOpSum ProjectOpVar )
type ProvidesEventId interface { ProvidedEventId() shared.EventId }
type ProvidesFqn interface { ProvidedFqn() shared.Fqn }
type ProvidesObjectId interface { ProvidedObjectId() shared.ObjectId }
type Txn interface { Delete(objectId shared.ObjectId, lastRead shared.Tt, vtFrom shared.Vt) Put(objectId shared.ObjectId, lastRead shared.Tt, vtFrom shared.Vt, blob *shared.Blob) Reinstate(objectId shared.ObjectId, lastRead shared.Tt, vtFrom shared.Vt) DeleteObject(object Indexable, vtFrom shared.Vt) error PutObject(object Indexable, vtFrom shared.Vt) error ReinstateObject(object Indexable, vtFrom shared.Vt) error HasEvent() bool Event() (shared.Event, error) SetEvent(ev shared.Event) error Objects() []Indexable WriteCommands() []*writerp.WriteRequest_WriteCommand }