api

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IdBatch = "Batch"

	BatchAdd    = "add"
	BatchDelete = "delete"
	BatchSet    = "set"
	BatchUpdate = "update"
)
View Source
const (
	IdAdd = "Add"
)
View Source
const (
	IdAssociated = "Associated"
)
View Source
const (
	IdCoTags = "CoTags"
)
View Source
const (
	IdDelete = "Delete"
)
View Source
const (
	IdDrop = "Drop"
)
View Source
const (
	IdDummy = "Dummy"
)
View Source
const (
	IdDump = "Dump"
)
View Source
const (
	IdExpand = "Expand"
)
View Source
const (
	IdQuery = "Query"
)
View Source
const (
	IdSet = "Set"
)
View Source
const (
	IdSync = "Sync"
)
View Source
const (
	IdUpdate = "Update"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddReply

type AddReply struct {
	ws.ReplyStatus
	OrigValue1 string
	OrigValue2 string
}

type AddRequest

type AddRequest struct {
	ws.Request
	CollectionInfo

	Key    string
	Value1 string
	Value2 string
}

func (*AddRequest) New

func (request *AddRequest) New() ws.RequestInterface

func (*AddRequest) Reply

func (request *AddRequest) Reply(env *ws.Environment) (ws.Reply, error)

type AssociatedOptions

type AssociatedOptions struct {
	MatchValue1 string
}

type AssociatedReply

type AssociatedReply struct {
	ws.ReplyStatus
	Result tiedb.TripleSet
}

type AssociatedRequest

type AssociatedRequest struct {
	ws.Request
	CollectionInfo

	Key string
	AssociatedOptions
}

func (*AssociatedRequest) New

func (request *AssociatedRequest) New() ws.RequestInterface

func (*AssociatedRequest) Reply

func (request *AssociatedRequest) Reply(env *ws.Environment) (ws.Reply, error)

type Batch

type Batch struct {
	Collection CollectionInfo `json:"collection"`
	Ops        []BatchOp      `json:"ops"`
}

Batch is an ordered list of write ops against one collection. Ops execute in slice order (the caller controls sequencing — e.g. a delete before an add to replace a value); every op is applied and checked, and the whole batch shares one durability Sync at the end.

func (*Batch) Add

func (batch *Batch) Add(key, relation, value string)

func (*Batch) Delete

func (batch *Batch) Delete(key, relation, value string)

func (*Batch) Set

func (batch *Batch) Set(key, relation string, values []string)

func (*Batch) Update

func (batch *Batch) Update(update Update)

type BatchOp

type BatchOp struct {
	Op           string   `json:"op"`
	Key          string   `json:"key"`
	Relation     string   `json:"relation"`
	Values       []string `json:"values"`
	NewValue     string   `json:"newValue"`
	AddOnFailure bool     `json:"addOnFailure"`
}

BatchOp is one write in a batch. Op selects the kind; the remaining fields are interpreted per Op:

  • add: add triple (Key, Relation, Values[0])
  • delete: delete triple (Key, Relation, Values[0])
  • set: replace (Key, Relation) with all of Values
  • update: change (Key, Relation, Values[0]) to NewValue; AddOnFailure adds NewValue when the original triple is absent

type BatchReply

type BatchReply struct {
	ws.ReplyStatus
}

type BatchRequest

type BatchRequest struct {
	ws.Request
	Batch *Batch `json:"batch"`
}

func NewBatchRequest

func NewBatchRequest(batch *Batch) *BatchRequest

func (*BatchRequest) New

func (request *BatchRequest) New() ws.RequestInterface

func (*BatchRequest) Reply

func (request *BatchRequest) Reply(env *ws.Environment) (ws.Reply, error)

type CoTagsReply

type CoTagsReply struct {
	ws.ReplyStatus
	Tags []string `json:"tags"`
}

CoTagsReply holds the sorted, deduplicated tag names that co-occur with the query. Tags is nil (not empty) when the query matched nothing.

type CoTagsRequest

type CoTagsRequest struct {
	ws.Request
	CollectionInfo

	Terms   []string `json:"terms"`
	Exclude []string `json:"exclude"`
	Scope   string   `json:"scope"`
}

CoTagsRequest asks for all unique tags carried by entries that match ALL of Terms (AND) and NONE of Exclude, optionally scoped to a tie-type value. This is the "faceted refinement" query: given the user's current tag filter, it returns the set of tags that can be used to further narrow the results.

Example: Terms=["tree","nature"] returns every tag found on files that carry both "tree" and "nature", e.g. ["2026","norway","sunset"].

func (*CoTagsRequest) New

func (request *CoTagsRequest) New() ws.RequestInterface

func (*CoTagsRequest) Reply

func (request *CoTagsRequest) Reply(env *ws.Environment) (ws.Reply, error)

type CollectionInfo

type CollectionInfo struct {
	Namespace    string
	CollectionId string
}

func (CollectionInfo) NewAddRequest

func (c CollectionInfo) NewAddRequest(key, value1, value2 string) *AddRequest

func (CollectionInfo) NewAssociatedRequest

func (c CollectionInfo) NewAssociatedRequest(key string) *AssociatedRequest

func (CollectionInfo) NewCoTagsRequest

func (c CollectionInfo) NewCoTagsRequest(terms, exclude []string, scope string) *CoTagsRequest

func (CollectionInfo) NewDeleteRequest

func (c CollectionInfo) NewDeleteRequest(key, value1, value2 string) *DeleteRequest

func (CollectionInfo) NewDropRequest

func (c CollectionInfo) NewDropRequest() *DropRequest

func (CollectionInfo) NewDummyRequest

func (c CollectionInfo) NewDummyRequest() *DummyRequest

func (CollectionInfo) NewDumpRequest

func (c CollectionInfo) NewDumpRequest() *DumpRequest

func (CollectionInfo) NewExpandRequest

func (c CollectionInfo) NewExpandRequest(keys []string, filter string) *ExpandRequest

func (CollectionInfo) NewQueryRequest

func (c CollectionInfo) NewQueryRequest() *QueryRequest

func (CollectionInfo) NewSetRequest

func (c CollectionInfo) NewSetRequest(key, relation string, values []string) *SetRequest

func (CollectionInfo) NewSyncRequest

func (c CollectionInfo) NewSyncRequest() *SyncRequest

func (CollectionInfo) NewUpdateRequest

func (c CollectionInfo) NewUpdateRequest(update Update) *UpdateRequest

type DeleteReply

type DeleteReply struct {
	ws.ReplyStatus
	OrigValue1 string
	OrigValue2 string
}

type DeleteRequest

type DeleteRequest struct {
	ws.Request
	CollectionInfo

	Key    string
	Value1 string
	Value2 string
}

func (*DeleteRequest) New

func (request *DeleteRequest) New() ws.RequestInterface

func (*DeleteRequest) Reply

func (request *DeleteRequest) Reply(env *ws.Environment) (ws.Reply, error)

type DropReply

type DropReply struct {
	ws.ReplyStatus
}

type DropRequest

type DropRequest struct {
	ws.Request
	CollectionInfo
}

func (*DropRequest) New

func (request *DropRequest) New() ws.RequestInterface

func (*DropRequest) Reply

func (request *DropRequest) Reply(env *ws.Environment) (ws.Reply, error)

type DummyReply

type DummyReply struct {
	ws.ReplyStatus
	Hello string
}

type DummyRequest

type DummyRequest struct {
	ws.Request
	CollectionInfo

	SomeData string
}

func (*DummyRequest) New

func (request *DummyRequest) New() ws.RequestInterface

func (*DummyRequest) Reply

func (request *DummyRequest) Reply(env *ws.Environment) (ws.Reply, error)

type DumpReply

type DumpReply struct {
	ws.ReplyStatus
	Triples []tiedb.StringTriple
}

type DumpRequest

type DumpRequest struct {
	ws.Request
	CollectionInfo
}

func (*DumpRequest) New

func (request *DumpRequest) New() ws.RequestInterface

func (*DumpRequest) Reply

func (request *DumpRequest) Reply(env *ws.Environment) (ws.Reply, error)

func (*DumpRequest) StreamReply

func (request *DumpRequest) StreamReply(env *ws.Environment, w io.Writer) error

StreamReply writes every forward triple as NDJSON (one JSON StringTriple per line) straight to w, so the server never buffers the whole collection. It drops the ReplyStatus envelope the buffered Reply carries — Dump always succeeds, and auth/not-found failures happen before any body byte is written.

type ExpandReply

type ExpandReply struct {
	ws.ReplyStatus
	Rows []tiedb.Row `json:"rows"`
}

type ExpandRequest

type ExpandRequest struct {
	ws.Request
	CollectionInfo

	Keys   []string `json:"keys"`
	Filter string   `json:"filter"`
}

ExpandRequest fetches the forward attributes of many keys in one round trip, returning one Row per key that exists. It collapses the N+1 pattern where a caller lists keys and then issues one Get per key to fetch their metadata. Filter filters-in on the relation (value1); empty means all relations.

func (*ExpandRequest) New

func (request *ExpandRequest) New() ws.RequestInterface

func (*ExpandRequest) Reply

func (request *ExpandRequest) Reply(env *ws.Environment) (ws.Reply, error)

type QueryReply

type QueryReply struct {
	ws.ReplyStatus
	Rows       []tiedb.Row `json:"rows"`
	TotalCount int         `json:"totalCount"`
}

QueryReply is the single, ordered result view. Rows is paginated per the request's Sort; TotalCount is the number of matching keys before pagination.

type QueryRequest

type QueryRequest struct {
	ws.Request
	CollectionInfo

	Terms           []string          `json:"terms"`
	Exclude         []string          `json:"exclude"`
	Scope           string            `json:"scope"`
	MissingRelation string            `json:"missingRelation"`
	Filter          string            `json:"filter"`
	Reverse         bool              `json:"reverse"`
	Expand          bool              `json:"expand"`
	Sort            tiedb.SortOptions `json:"sort"`
}

QueryRequest selects entries by association membership and returns them as a flat, ordered list of Rows. Terms is the full AND-list (every match must be associated with all of them); there is no positional seed key. Exclude lists terms a match must NOT carry. Scope restricts matches to associates of that value under a different relation than the terms (e.g. a tie-type). MissingRelation keeps only matches that carry no triple under the named relation — the "has no tag" case Exclude cannot express (Exclude removes a specific value, not the presence of a relation). Filter filters-in on the relation (value1). Reverse selects matches by reverse association (the tag-query case). When Expand is set, each match's own forward attributes are attached to its Row instead of the matched triples.

func (*QueryRequest) New

func (request *QueryRequest) New() ws.RequestInterface

func (*QueryRequest) Reply

func (request *QueryRequest) Reply(env *ws.Environment) (ws.Reply, error)

type SetReply

type SetReply struct {
	ws.ReplyStatus
}

type SetRequest

type SetRequest struct {
	ws.Request
	CollectionInfo

	Key      string   `json:"key"`
	Relation string   `json:"relation"`
	Values   []string `json:"values"`
}

SetRequest makes (Key, Relation) hold exactly Values: it replaces the whole value set for that relation in one server-side op. This is the first-class "set this field" primitive that replaces the client Get -> Delete-each -> Add dance. An empty Values clears the relation.

func (*SetRequest) New

func (request *SetRequest) New() ws.RequestInterface

func (*SetRequest) Reply

func (request *SetRequest) Reply(env *ws.Environment) (ws.Reply, error)

type SyncReply

type SyncReply struct {
	ws.ReplyStatus
}

type SyncRequest

type SyncRequest struct {
	ws.Request
	CollectionInfo
}

func (*SyncRequest) New

func (request *SyncRequest) New() ws.RequestInterface

func (*SyncRequest) Reply

func (request *SyncRequest) Reply(env *ws.Environment) (ws.Reply, error)

type Update

type Update struct {
	Key          string
	Value1       string
	Value2       string
	NewValue2    string
	AddOnFailure bool
}

type UpdateReply

type UpdateReply struct {
	ws.ReplyStatus
	OrigValue1    string
	OrigValue2    string
	OrigNewValue2 string
}

type UpdateRequest

type UpdateRequest struct {
	ws.Request
	CollectionInfo
	Update
}

func (*UpdateRequest) New

func (request *UpdateRequest) New() ws.RequestInterface

func (*UpdateRequest) Reply

func (request *UpdateRequest) Reply(env *ws.Environment) (ws.Reply, error)

Jump to

Keyboard shortcuts

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