schema

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package schema is the schema of the SQLite store: its tables, its queries, and the types which are read from, and written to, them

Index

Constants

View Source
const CacheVersion = 1

CacheVersion is the version of the cache's schema, of the database's user_version

View Source
const Version = 19

Version is the version of the schema, of the database's user_version

Variables

This section is empty.

Functions

func Create

func Create(ctx context.Context, conn sqlite.Conn) error

Create creates the schema, in a transaction, when the database hasn't one, and sets its version. A database whose schema is newer is an error.

func CreateCache

func CreateCache(ctx context.Context, conn sqlite.Conn) error

CreateCache creates the cache's schema, when the database hasn't one, with its space reclaimed incrementally, and sets its version. A database whose schema is newer is an error.

func Did

func Did(kind store.Kind) string

Did returns the kind of the rows of the revisions which a task's work is done of, which is its kind, with _done after it

func Functions

func Functions() []sqlite.Opt

Functions returns the options of the functions which the queries of the search of objects call, of each connection

func Match

func Match(query filer.Query) string

Match returns the FTS5 query of a query's terms, any of which match, of those which aren't excluded, or empty, without terms

func NewCacheQueries

func NewCacheQueries() (*sqlite.Queries, error)

NewCacheQueries returns the cache's queries, which a connection is bound to, with WithQueries, so the types' selectors and writers use them

func NewQueries

func NewQueries() (*sqlite.Queries, error)

NewQueries returns the queries, which a connection is bound to, with WithQueries, so the types' selectors and writers use them

Types

type CacheChunk

type CacheChunk struct {
	Entry int64
	N     int64
	Data  []byte
}

CacheChunk is a chunk of an entry's content, of its index

func (CacheChunk) Insert

func (chunk CacheChunk) Insert(bind *sqlite.Bind) (string, error)

func (CacheChunk) Update

func (chunk CacheChunk) Update(*sqlite.Bind) error

type CacheCommit

type CacheCommit struct {
	Id      int64
	Key     string
	Meta    store.CacheMeta
	Size    int64
	Now     time.Time
	Expires time.Time
}

CacheCommit is an entry, which is written, of its key, and what it is

func (CacheCommit) Insert

func (commit CacheCommit) Insert(*sqlite.Bind) (string, error)

func (CacheCommit) Select

func (commit CacheCommit) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

func (CacheCommit) Update

func (commit CacheCommit) Update(bind *sqlite.Bind) error

Update binds an entry's key, and what it is, which its id selects

type CacheCreate

type CacheCreate struct {
	Now time.Time
}

CacheCreate is an entry, without a key, which its content is written to, whose id is returned

func (CacheCreate) Insert

func (create CacheCreate) Insert(bind *sqlite.Bind) (string, error)

func (CacheCreate) Update

func (create CacheCreate) Update(*sqlite.Bind) error

type CacheData

type CacheData []byte

CacheData is the data of a chunk which is read

func (*CacheData) Scan

func (data *CacheData) Scan(row sqlite.Row) error

Scan reads a chunk's data

type CacheEntry

type CacheEntry struct {
	Id      int64
	Key     string
	Meta    store.CacheMeta
	Size    int64
	Stored  time.Time
	Expires time.Time
}

CacheEntry is an entry of a volume's cache, as it's stored

func (*CacheEntry) Scan

func (entry *CacheEntry) Scan(row sqlite.Row) error

Scan reads an entry

type CacheExpired

type CacheExpired time.Time

CacheExpired selects the entries whose TTLs have passed, at the time, which are released

func (CacheExpired) Select

func (expired CacheExpired) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

type CacheId

type CacheId int64

CacheId selects an entry, of its id, which is deleted

func (CacheId) Select

func (id CacheId) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

type CacheIds

type CacheIds []int64

CacheIds is the ids of the entries which are released, or deleted, or created

func (*CacheIds) Scan

func (ids *CacheIds) Scan(row sqlite.Row) error

Scan reads an id, of each row

type CacheKey

type CacheKey string

CacheKey selects the entry of a key, which is got, or released

func (CacheKey) Select

func (key CacheKey) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

type CachePrefix

type CachePrefix string

CachePrefix selects the entries of the keys which start with it, which are released

func (CachePrefix) Select

func (prefix CachePrefix) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

type CacheRead

type CacheRead struct {
	Entry int64
	N     int64
}

CacheRead selects a chunk of an entry's content, of its index

func (CacheRead) Select

func (read CacheRead) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

type Kinds

type Kinds map[string]uint64

Kinds is how many objects are of each kind, of their metadata, or else their media type, or "", of none

func (*Kinds) Scan

func (kinds *Kinds) Scan(row sqlite.Row) error

type KindsRequest

type KindsRequest struct {
	Volume string
}

KindsRequest selects how many objects, without folders, of a volume are of each kind

func (KindsRequest) Select

func (req KindsRequest) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

type ObjectCount

type ObjectCount uint64

ObjectCount is how many objects a listing has

func (*ObjectCount) Scan

func (count *ObjectCount) Scan(row sqlite.Row) error

type ObjectCountRequest

type ObjectCountRequest struct {
	Volume string
	store.ListRequest
}

ObjectCountRequest selects how many objects a listing has, of every page, without where it starts after, or its limit

func (ObjectCountRequest) Select

func (req ObjectCountRequest) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

type ObjectKey

type ObjectKey struct {
	Volume string
	Key    string
}

ObjectKey selects an object of a volume, of its key, which is got, or deleted, with every object beneath it, of a folder's

func (ObjectKey) Select

func (key ObjectKey) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

type ObjectList

type ObjectList []*filer.Object

ObjectList is the objects which are read, of a list, or a get, which reads one

func (*ObjectList) Scan

func (list *ObjectList) Scan(row sqlite.Row) error

type ObjectListRequest

type ObjectListRequest struct {
	Volume string
	store.ListRequest
}

ObjectListRequest selects the objects of a folder, or every object beneath it, in the order of their keys

func (ObjectListRequest) Select

func (req ObjectListRequest) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

type ObjectMetaPut

type ObjectMetaPut struct {
	Volume string
	Key    string
	Source string
	filer.TaskMeta
}

ObjectMetaPut is the metadata of an object of a volume, of a source, which replaces the source's

func (ObjectMetaPut) Insert

func (put ObjectMetaPut) Insert(bind *sqlite.Bind) (string, error)

Insert binds the metadata, as a JSON array, of its source, and returns the query which replaces the source's metadata of the object

func (ObjectMetaPut) Update

func (put ObjectMetaPut) Update(*sqlite.Bind) error

type ObjectMetaSource

type ObjectMetaSource struct {
	Volume string
	Source string
}

ObjectMetaSource selects the metadata of a source of a volume, and its task's state, which is deleted

func (ObjectMetaSource) Select

func (source ObjectMetaSource) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

type ObjectPut

type ObjectPut struct {
	Volume string
	*filer.Object
}

ObjectPut is an object of a volume, which is put, with its metadata

func (ObjectPut) Insert

func (put ObjectPut) Insert(bind *sqlite.Bind) (string, error)

Insert binds an object, and its metadata, as a JSON array, and returns the query which puts it, replacing the object at its path, and its metadata

func (ObjectPut) Update

func (put ObjectPut) Update(*sqlite.Bind) error

type Pending

type Pending bool

Pending is whether a key has work which would change its index

func (*Pending) Scan

func (pending *Pending) Scan(row sqlite.Row) error

type QueueDid

type QueueDid struct {
	Volume   string
	Key      string
	Kind     store.Kind
	Revision string
	Error    string // Why it was given up, or empty when it was done
	Now      time.Time
}

QueueDid is the revision of a file which a task's work was done of

func (QueueDid) Insert

func (did QueueDid) Insert(bind *sqlite.Bind) (string, error)

Insert binds the file, and the kind of its task

func (QueueDid) Update

func (did QueueDid) Update(*sqlite.Bind) error

type QueueDue

type QueueDue struct {
	Volume string
	Kinds  []store.Kind
	Now    time.Time
	Limit  int
}

QueueDue selects the work of a volume, of the kinds, which is due, and isn't leased, at the time, up to the limit

func (QueueDue) Select

func (due QueueDue) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

type QueueFailure

type QueueFailure struct {
	Error  string
	Outage bool      // It failed as its backend was unavailable, which isn't an attempt
	Failed time.Time // When it failed
	After  time.Time // When it's due again
}

QueueFailure is why work failed, and when it's due again

func (QueueFailure) Insert

func (failure QueueFailure) Insert(*sqlite.Bind) (string, error)

func (QueueFailure) Update

func (failure QueueFailure) Update(bind *sqlite.Bind) error

Update binds why the work failed, and when it's due again

type QueueKey

type QueueKey struct {
	Volume string
	store.Work
}

QueueKey selects work of a volume, of its key and kind, which is leased, done, or failed, of its lease

func (QueueKey) Select

func (key QueueKey) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

Select binds the work, of its lease, which is leased, done or failed

type QueueLease

type QueueLease time.Time

QueueLease is the lease of work, until when it ends

func (QueueLease) Insert

func (lease QueueLease) Insert(*sqlite.Bind) (string, error)

func (QueueLease) Update

func (lease QueueLease) Update(bind *sqlite.Bind) error

Update binds the lease, until when it ends

type QueuePending

type QueuePending struct {
	Volume  string
	Key     string
	Beneath bool // Work beneath the folder's key too, of its listing
}

QueuePending selects whether a key of a volume has work which would change its index

func (QueuePending) Select

func (pending QueuePending) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

type QueuePush

type QueuePush struct {
	Volume string
	store.Work
}

QueuePush is work of a volume, which is pushed

func (QueuePush) Insert

func (push QueuePush) Insert(bind *sqlite.Bind) (string, error)

Insert binds the work, with the folders above it, of a rescan, or of an index, and its own key, too, as a rescan of a folder's key does it

func (QueuePush) Update

func (push QueuePush) Update(*sqlite.Bind) error

type QueueStale

type QueueStale struct {
	Volume string
	Folder string
	Kind   store.Kind
	Now    time.Time
	Trace  string // The W3C traceparent of the span which queued it, or empty
}

QueueStale is the work of a task of the files beneath a folder, which are stale

func (QueueStale) Insert

func (stale QueueStale) Insert(bind *sqlite.Bind) (string, error)

Insert binds the folder, and the kind of the task

func (QueueStale) Update

func (stale QueueStale) Update(*sqlite.Bind) error

type QueueTasks

type QueueTasks struct {
	Volume string
	Kind   store.Kind
	filer.TaskState
}

QueueTasks is the work of a task of a volume's files, which is read

func (*QueueTasks) Scan

func (tasks *QueueTasks) Scan(row sqlite.Row) error

Scan reads the work of the task

func (QueueTasks) Select

func (tasks QueueTasks) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

Select binds the volume, and the kinds of the task's work, and what it did

type RevisionListRequest

type RevisionListRequest struct {
	Volume    string
	Folder    string
	Recursive bool
}

RevisionListRequest selects the revisions of the files of a folder's key, or beneath it

func (RevisionListRequest) Select

func (req RevisionListRequest) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

type RevisionPut

type RevisionPut struct {
	Volume   string
	Key      string
	Revision string
	Now      time.Time
}

RevisionPut is the revision of a file of a volume, which is put

func (RevisionPut) Insert

func (put RevisionPut) Insert(bind *sqlite.Bind) (string, error)

Insert binds the revision of a file, which replaces the one it has

func (RevisionPut) Update

func (put RevisionPut) Update(*sqlite.Bind) error

type Revisions

type Revisions map[string]string

Revisions is the revisions which are read, by their keys

func (*Revisions) Scan

func (revisions *Revisions) Scan(row sqlite.Row) error

type ScanChanged

type ScanChanged struct {
	Volume string
	Folder string
	After  string
	Limit  int
}

ScanChanged selects the files which a scan of a folder of a volume has seen, which have changed, after the key, up to the limit

func (ScanChanged) Select

func (changed ScanChanged) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

type ScanChangedList

type ScanChangedList []store.Seen

ScanChangedList is the files which are read, which have changed

func (*ScanChangedList) Scan

func (list *ScanChangedList) Scan(row sqlite.Row) error

type ScanCount

type ScanCount uint64

ScanCount is how many files have changed

func (*ScanCount) Scan

func (count *ScanCount) Scan(row sqlite.Row) error

type ScanFolder

type ScanFolder struct {
	Volume string
	Folder string
}

ScanFolder selects what a scan of a folder of a volume has seen, which is forgotten, swept, or counted, of its changed files

func (ScanFolder) Select

func (folder ScanFolder) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

type ScanSeen

type ScanSeen struct {
	Volume   string
	Key      string
	Revision string
	Now      time.Time
}

ScanSeen is a key of a volume which a scan has seen, with the revision of its listing, which is put

func (ScanSeen) Insert

func (seen ScanSeen) Insert(bind *sqlite.Bind) (string, error)

Insert binds the key, and its revision, which replaces the one it has

func (ScanSeen) Update

func (seen ScanSeen) Update(*sqlite.Bind) error

type ScanSweep

type ScanSweep ScanFolder

func (ScanSweep) Select

func (sweep ScanSweep) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

type ScanUnsee

type ScanUnsee ScanFolder

ScanUnsee, and ScanSweep, are the deletions of a scan's folder

func (ScanUnsee) Select

func (unsee ScanUnsee) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

type SearchCount

type SearchCount struct {
	Count uint64
	Best  float64
}

SearchCount is how many objects match a search, and the score of the best

func (SearchCount) Rank

func (count SearchCount) Rank(score float64) float32

Rank returns how well a score matches, of 0 to 1, of the best of its search's, which is 1

func (*SearchCount) Scan

func (count *SearchCount) Scan(row sqlite.Row) error

Scan reads how many objects match, and the score of the best

type SearchHit

type SearchHit struct {
	Volume string
	Key    string
	Score  float64
}

SearchHit is an object which matches a search, of its volume, and key, and its score, of bm25, which is the better, the more negative

type SearchHits

type SearchHits []SearchHit

SearchHits are the objects which match a search, best first

func (*SearchHits) Scan

func (hits *SearchHits) Scan(row sqlite.Row) error

Scan reads an object which matches

type SearchRefresh

type SearchRefresh struct {
	Volume string
	From   string
	To     string
}

SearchRefresh is the search of the objects of a volume, of the range of their keys, from one, to one after, which is refreshed, of what they are now

func KeyRefresh

func KeyRefresh(volume, key string) SearchRefresh

////////////////////////////////////////////////////////////////////////////// KeyRefresh returns the refresh of the search of an object, of its key

func VolumeRefresh

func VolumeRefresh(volume string) SearchRefresh

VolumeRefresh returns the refresh of the search of every object of a volume

func (SearchRefresh) Insert

func (r SearchRefresh) Insert(bind *sqlite.Bind) (string, error)

Insert binds the refresh of the search of the objects

func (SearchRefresh) Update

func (r SearchRefresh) Update(*sqlite.Bind) error

type SearchRequest

type SearchRequest struct {
	filer.SearchRequest
}

SearchRequest selects the objects which match a query, best first, of the weights of their columns, of its page, or, of a get, how many match

func (SearchRequest) Select

func (req SearchRequest) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

Select binds the match of the search, of the query's terms, and its page, of a list, or of a get, its count

type VolumeList

type VolumeList []*filer.Volume

VolumeList is the volumes which are read, of a list, or a get, which reads one

func (*VolumeList) Scan

func (list *VolumeList) Scan(row sqlite.Row) error

type VolumeListRequest

type VolumeListRequest struct{}

VolumeListRequest selects every volume, in the order of their names

func (VolumeListRequest) Select

func (VolumeListRequest) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

type VolumeName

type VolumeName string

VolumeName selects a volume, of its name, which is got, or deleted

func (VolumeName) Select

func (name VolumeName) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

type VolumePut

type VolumePut filer.VolumeMeta

VolumePut is a volume which is created, or whose URL, and whether it's enabled, are updated

func (VolumePut) Insert

func (put VolumePut) Insert(bind *sqlite.Bind) (string, error)

Insert binds a volume, and returns the query which creates it

func (VolumePut) Update

func (put VolumePut) Update(bind *sqlite.Bind) error

Update binds a volume's URL, and whether it's enabled

type VolumeState

type VolumeState struct {
	Name string
	filer.IndexState
}

VolumeState is the state of a volume's index, of its name, which is got, and updated

func (VolumeState) Insert

func (state VolumeState) Insert(*sqlite.Bind) (string, error)

func (*VolumeState) Scan

func (state *VolumeState) Scan(row sqlite.Row) error

func (VolumeState) Select

func (state VolumeState) Select(bind *sqlite.Bind, op sqlite.Op) (string, error)

func (VolumeState) Update

func (state VolumeState) Update(bind *sqlite.Bind) error

Update binds the state, whose zero values are NULL

type WorkList

type WorkList []store.Work

WorkList is the work which is read

func (*WorkList) Scan

func (list *WorkList) Scan(row sqlite.Row) error

Jump to

Keyboard shortcuts

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