schema

package
v0.2.25 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventProgress = "progress"
	EventError    = "error"
	EventDone     = "done"
)

Event names used with httpresponse.TextStream for long-running operations (e.g. reindexing) that report progress over a text/event-stream response.

View Source
const (
	DefaultSchema = "filer"
	NotifyChannel = "filer_changes"

	// Content types which should move to the types package
	ContentTypeDirectory           = "text/directory"
	ContentObjectHeader            = "X-Object"
	ContentIfMatchHeader           = "If-Match"
	ContentIfNoneMatchHeader       = "If-None-Match"
	ContentIfModifiedSinceHeader   = "If-Modified-Since"
	ContentIfUnmodifiedSinceHeader = "If-Unmodified-Since"
	AttrLastModified               = "last-modified"
)
View Source
const (
	VolumeListLimit      = 100
	ObjectListLimit      = 1000
	MetadataListLimit    = 100
	LLMProviderListLimit = 100
	SearchListLimit      = 25

	// MaxUploadFiles is the maximum number of files accepted in a single multipart upload request.
	MaxUploadFiles = 1000
)

Variables

View Source
var Objects string
View Source
var Queries string

Functions

func MatchesContentType added in v0.2.20

func MatchesContentType(contentType, filter string) bool

MatchesContentType reports whether contentType satisfies filter, using the same semantics as ObjectListRequest.Select's SQL WHERE clause: an exact match if filter contains a '/', otherwise a match against either the major or minor component (e.g. "image" matches "image/jpeg" and "x/image"). An empty filter matches everything.

Types

type Artwork added in v0.2.16

type Artwork struct {
	ETag ArtworkKey `json:"key"`
	ArtworkMeta
	CreatedAt time.Time `json:"created_at"`
}

Artwork represents one or more thumbnails, which are attached to objects and keyed by their etag

func (*Artwork) Scan added in v0.2.16

func (o *Artwork) Scan(row pg.Row) error

func (Artwork) String added in v0.2.16

func (o Artwork) String() string

type ArtworkInfo added in v0.2.16

type ArtworkInfo struct {
	ETag      ArtworkKey `json:"key"`
	Type      string     `json:"type"`
	Width     uint64     `json:"width"`
	Height    uint64     `json:"height"`
	CreatedAt time.Time  `json:"created_at"`
}

ArtworkInfo is artwork metadata without the binary data, used for conditional requests.

func (*ArtworkInfo) Scan added in v0.2.16

func (o *ArtworkInfo) Scan(row pg.Row) error

type ArtworkInfoKey added in v0.2.16

type ArtworkInfoKey ArtworkKey

ArtworkInfoKey selects artwork metadata only (no binary data)

func (ArtworkInfoKey) Select added in v0.2.16

func (k ArtworkInfoKey) Select(bind *pg.Bind, op pg.Op) (string, error)

type ArtworkKey added in v0.2.16

type ArtworkKey string

ArtworkKey is the key of an artwork, which is a hash of the artwork data

func (ArtworkKey) Select added in v0.2.16

func (k ArtworkKey) Select(bind *pg.Bind, op pg.Op) (string, error)

type ArtworkMeta added in v0.2.16

type ArtworkMeta struct {
	Data   []byte `json:"data"`
	Type   string `json:"type"`
	Width  uint64 `json:"width"`
	Height uint64 `json:"height"`
}

ArtworkMeta represents metadata for one or more thumbnails, which are attached to objects and keyed by their etag

func (ArtworkMeta) Insert added in v0.2.16

func (o ArtworkMeta) Insert(bind *pg.Bind) (string, error)

func (ArtworkMeta) String added in v0.2.16

func (k ArtworkMeta) String() string

func (ArtworkMeta) Update added in v0.2.16

func (o ArtworkMeta) Update(bind *pg.Bind) error

type ArtworkUploadRequest added in v0.2.16

type ArtworkUploadRequest struct {
	Data types.File `json:"data" validate:"required"`
}

ArtworkUploadRequest represents a request to upload an artwork

type CreateObjectRequest

type CreateObjectRequest struct {
	ObjectKey
	Body        io.Reader `json:"-"`
	IfNotExists bool      // if true, fail with ErrConflict when the object already exists
	ModTime     time.Time `json:"last-modified,omitzero"`
	ObjectMeta
}

Operations

func (CreateObjectRequest) String

func (r CreateObjectRequest) String() string

type DeleteObjectRequest

type DeleteObjectRequest struct {
	ObjectKey
}

func (DeleteObjectRequest) String

func (r DeleteObjectRequest) String() string

type DeleteObjectsRequest

type DeleteObjectsRequest struct {
	ObjectKey
}

func (DeleteObjectsRequest) String

func (r DeleteObjectsRequest) String() string

type DeleteObjectsResponse

type DeleteObjectsResponse struct {
	Body []Object `json:"body,omitempty"` // list of deleted objects
}

func (DeleteObjectsResponse) String

func (r DeleteObjectsResponse) String() string

type GetArtworkRequest added in v0.2.16

type GetArtworkRequest struct {
	Key             ArtworkKey `json:"key" validate:"required"`
	IfModifiedSince *time.Time `json:"if_modified_since,omitempty"`
	IfNoneMatch     *string    `json:"if_none_match,omitempty"`
}

GetArtworkRequest represents a request to get artwork

type GetObjectRequest

type GetObjectRequest struct {
	ObjectKey
}

func (GetObjectRequest) String

func (r GetObjectRequest) String() string

type LLMProvider added in v0.2.10

type LLMProvider struct {
	LLMProviderCreate
	CreatedAt time.Time `json:"created_at,omitempty"`
}

func (LLMProvider) Cell added in v0.2.10

func (r LLMProvider) Cell(col int) string

func (LLMProvider) Header added in v0.2.10

func (r LLMProvider) Header() []string

func (*LLMProvider) Scan added in v0.2.10

func (l *LLMProvider) Scan(row pg.Row) error

func (LLMProvider) String added in v0.2.10

func (l LLMProvider) String() string

func (LLMProvider) Width added in v0.2.10

func (r LLMProvider) Width(col int) int

type LLMProviderCreate added in v0.2.10

type LLMProviderCreate struct {
	LLMProviderMeta
	Provider string `json:"provider,omitempty" enum:"anthropic,gemini,mistral,ollama,openai" arg:"" help:"Provider type"`
}

func (LLMProviderCreate) Insert added in v0.2.10

func (l LLMProviderCreate) Insert(bind *pg.Bind) (string, error)

func (LLMProviderCreate) String added in v0.2.10

func (l LLMProviderCreate) String() string

type LLMProviderList added in v0.2.10

type LLMProviderList struct {
	LLMProviderListRequest
	Count uint64         `json:"count,omitempty"`
	Body  []*LLMProvider `json:"body,omitempty"`
}

func (*LLMProviderList) Scan added in v0.2.10

func (l *LLMProviderList) Scan(row pg.Row) error

func (*LLMProviderList) ScanCount added in v0.2.10

func (l *LLMProviderList) ScanCount(row pg.Row) error

func (LLMProviderList) String added in v0.2.10

func (l LLMProviderList) String() string

type LLMProviderListRequest added in v0.2.10

type LLMProviderListRequest struct {
	pg.OffsetLimit
}

func (LLMProviderListRequest) Query added in v0.2.10

func (r LLMProviderListRequest) Query() url.Values

func (*LLMProviderListRequest) Select added in v0.2.10

func (l *LLMProviderListRequest) Select(bind *pg.Bind, op pg.Op) (string, error)

func (LLMProviderListRequest) String added in v0.2.10

func (l LLMProviderListRequest) String() string

type LLMProviderMeta added in v0.2.10

type LLMProviderMeta struct {
	Name       *string `json:"name,omitempty" help:"Provider name"`
	URL        *string `json:"url,omitempty" help:"Provider URL (only used for the ollama provider)"`
	Credential *string `json:"credential,omitempty" help:"Credential key for authentication (required for all providers except ollama)"`
}

func (LLMProviderMeta) Insert added in v0.2.10

func (l LLMProviderMeta) Insert(bind *pg.Bind) (string, error)

func (LLMProviderMeta) String added in v0.2.10

func (l LLMProviderMeta) String() string

func (LLMProviderMeta) Update added in v0.2.10

func (l LLMProviderMeta) Update(bind *pg.Bind) error

type LLMProviderName added in v0.2.10

type LLMProviderName string

func (LLMProviderName) Select added in v0.2.10

func (l LLMProviderName) Select(bind *pg.Bind, op pg.Op) (string, error)

type Meta added in v0.2.0

type Meta struct {
	Key   string          `json:"key,omitempty"`
	Value json.RawMessage `json:"value,omitempty"`
}

Meta is a string key-value map for user-defined object metadata. Keys should be lowercase for S3 compatibility, as S3 normalizes all metadata keys to lowercase.

func AppendMeta added in v0.2.0

func AppendMeta(kv []Meta, key string, value any) []Meta

func (Meta) Insert added in v0.2.0

func (m Meta) Insert(bind *pg.Bind) (string, error)

func (*Meta) Scan added in v0.2.0

func (m *Meta) Scan(row pg.Row) error

func (Meta) Update added in v0.2.0

func (m Meta) Update(bind *pg.Bind) error

type Metadata added in v0.1.2

type Metadata struct {
	Key       string    `json:"key,omitempty"`
	IndexedAt time.Time `json:"indexed_at,omitzero"`
	MetadataCreate
}

func (Metadata) Cell added in v0.2.0

func (r Metadata) Cell(col int) string

func (Metadata) Header added in v0.2.0

func (r Metadata) Header() []string

func (*Metadata) Scan added in v0.1.2

func (m *Metadata) Scan(row pg.Row) error

func (Metadata) String added in v0.1.2

func (m Metadata) String() string

func (Metadata) Width added in v0.2.0

func (r Metadata) Width(col int) int

type MetadataCreate added in v0.2.0

type MetadataCreate struct {
	Filename   string    `json:"filename,omitempty"`
	Etag       string    `json:"etag,omitempty"`
	Size       int64     `json:"size"`
	ModifiedAt time.Time `json:"modified_at,omitzero"`
	MetadataMeta
}

func (MetadataCreate) Insert added in v0.2.0

func (m MetadataCreate) Insert(bind *pg.Bind) (string, error)

type MetadataKV added in v0.2.0

type MetadataKV struct {
	Metadata string          `json:"-"`
	Key      string          `json:"key,omitempty"`
	Value    json.RawMessage `json:"value,omitempty"`
}

func AppendMetadataKV added in v0.2.0

func AppendMetadataKV(metadata []MetadataKV, key string, value any) []MetadataKV

func (MetadataKV) Insert added in v0.2.0

func (m MetadataKV) Insert(bind *pg.Bind) (string, error)

func (*MetadataKV) Scan added in v0.2.0

func (m *MetadataKV) Scan(row pg.Row) error

func (MetadataKV) String added in v0.2.0

func (m MetadataKV) String() string

func (MetadataKV) Update added in v0.2.0

func (m MetadataKV) Update(bind *pg.Bind) error

type MetadataKey added in v0.2.0

type MetadataKey string

func (MetadataKey) Select added in v0.2.0

func (k MetadataKey) Select(bind *pg.Bind, op pg.Op) (string, error)

type MetadataList added in v0.2.0

type MetadataList struct {
	MetadataListRequest
	Count uint64      `json:"count"`
	Body  []*Metadata `json:"body"`
}

func (*MetadataList) Scan added in v0.2.0

func (l *MetadataList) Scan(row pg.Row) error

func (*MetadataList) ScanCount added in v0.2.0

func (l *MetadataList) ScanCount(row pg.Row) error

func (MetadataList) String added in v0.2.0

func (r MetadataList) String() string

type MetadataListRequest added in v0.2.0

type MetadataListRequest struct {
	Title *string `json:"title,omitempty" help:"filter by title"`
	Type  *string `json:"type,omitempty" help:"media type filter"`
	pg.OffsetLimit
}

func (*MetadataListRequest) Select added in v0.2.0

func (r *MetadataListRequest) Select(bind *pg.Bind, op pg.Op) (string, error)

func (MetadataListRequest) String added in v0.2.0

func (r MetadataListRequest) String() string

type MetadataMeta added in v0.1.2

type MetadataMeta struct {
	Title    string       `json:"title,omitempty"`
	Type     string       `json:"media_type,omitempty"`
	Summary  *string      `json:"summary,omitempty"`
	Tags     []string     `json:"tags,omitempty"`
	Metadata []MetadataKV `json:"metadata,omitempty"`
}

func (MetadataMeta) MetaMap added in v0.2.0

func (r MetadataMeta) MetaMap() map[string]any

func (MetadataMeta) String added in v0.1.2

func (m MetadataMeta) String() string

func (MetadataMeta) Update added in v0.1.2

func (m MetadataMeta) Update(bind *pg.Bind) error

type MetadataQueryRequest added in v0.2.0

type MetadataQueryRequest struct {
	Query string  `json:"query,omitempty" arg:"" required:"" help:"full text search query"`
	Type  *string `json:"type,omitempty" help:"media type filter"`
	pg.OffsetLimit
}

func (*MetadataQueryRequest) Select added in v0.2.0

func (r *MetadataQueryRequest) Select(bind *pg.Bind, op pg.Op) (string, error)

func (MetadataQueryRequest) String added in v0.2.0

func (r MetadataQueryRequest) String() string

type Object

type Object struct {
	ObjectKey
	ObjectMeta
	ObjectAttr
	Artwork []ArtworkInfo `json:"artwork,omitempty"`
}

Object represents a single stored item returned by the API.

func (Object) Cell added in v0.2.0

func (r Object) Cell(col int) string

func (Object) Header added in v0.2.0

func (r Object) Header() []string

func (Object) Matches added in v0.2.14

func (o Object) Matches(other *Object) bool

func (*Object) Scan added in v0.1.2

func (o *Object) Scan(row pg.Row) error

func (Object) String

func (o Object) String() string

func (Object) Width added in v0.2.0

func (r Object) Width(col int) int

type ObjectArtwork added in v0.2.16

type ObjectArtwork struct {
	ObjectKey
	ArtworkKey ArtworkKey `json:"artwork_key"`
}

ObjectArtwork represents a link between an object and artwork

func (ObjectArtwork) Insert added in v0.2.16

func (o ObjectArtwork) Insert(bind *pg.Bind) (string, error)

func (*ObjectArtwork) Scan added in v0.2.16

func (o *ObjectArtwork) Scan(row pg.Row) error

func (ObjectArtwork) Select added in v0.2.16

func (o ObjectArtwork) Select(bind *pg.Bind, op pg.Op) (string, error)

func (ObjectArtwork) String added in v0.2.16

func (o ObjectArtwork) String() string

func (ObjectArtwork) Update added in v0.2.16

func (o ObjectArtwork) Update(bind *pg.Bind) error

type ObjectAttr added in v0.2.0

type ObjectAttr struct {
	Size    *int64    `json:"size,omitempty"`
	ETag    *string   `json:"etag,omitempty"`
	ModTime time.Time `json:"last-modified,omitzero"`
}

ObjectAttr represents the attributes of an object, which are immutable and cannot be updated.

type ObjectCreate added in v0.2.0

type ObjectCreate struct {
	ObjectKey
	ObjectMeta
	ObjectAttr
}

ObjectCreate represents the result of creating an object in the database as part of indexing

func (ObjectCreate) Insert added in v0.2.0

func (o ObjectCreate) Insert(bind *pg.Bind) (string, error)

type ObjectKey added in v0.1.2

type ObjectKey struct {
	Volume string `json:"volume,omitempty" arg:"" required:"" help:"Volume name"`
	Path   string `json:"path,omitempty" arg:"" required:"" help:"Object path"`
}

ObjectKey represents the unique identifier of an object, which consists of a volume and a path.

func (ObjectKey) Select added in v0.1.2

func (k ObjectKey) Select(bind *pg.Bind, op pg.Op) (string, error)

func (ObjectKey) String added in v0.1.2

func (k ObjectKey) String() string

type ObjectList added in v0.2.0

type ObjectList struct {
	ObjectListRequest
	Count int       `json:"count,omitempty"` // total number of matching objects, before offset/limit
	Body  []*Object `json:"body,omitempty"`  // page of objects; nil when Limit==0 (count-only)
}

func (*ObjectList) Scan added in v0.2.0

func (l *ObjectList) Scan(row pg.Row) error

func (*ObjectList) ScanCount added in v0.2.0

func (l *ObjectList) ScanCount(row pg.Row) error

func (ObjectList) String added in v0.2.0

func (r ObjectList) String() string

type ObjectListFilters added in v0.2.16

type ObjectListFilters struct {
	Path      *string `json:"path,omitempty"`                             //  Path prefix within the backend
	Recursive bool    `json:"recursive,omitempty" short:"r" negatable:""` // List all objects or directories recursively, otherwise list only immediate children
	Type      *string `json:"type,omitempty"`                             // optional content type to filter by. If text/directory, will return directories, rather than objects
}

func (ObjectListFilters) String added in v0.2.16

func (r ObjectListFilters) String() string

type ObjectListIterator added in v0.2.14

type ObjectListIterator struct {
	Path      *string   `json:"path,omitempty"`                             // Path prefix within the backend
	Type      *string   `json:"type,omitempty"`                             // optional content type to filter by. If text/directory, will return directories, rather than objects
	Recursive bool      `json:"recursive,omitempty" short:"r" negatable:""` // List all objects or directories recursively, otherwise list only immediate children
	Token     any       `json:"-"`                                          // optional token to continue listing from a previous request
	Body      []*Object `json:"body,omitempty"`                             // page of objects or folders returned by the backend
}

type ObjectListRequest added in v0.2.0

type ObjectListRequest struct {
	Volume string `json:"volume" arg:"" required:""` // Volume name to filter by
	pg.OffsetLimit
	ObjectListFilters
}

func (ObjectListRequest) Query added in v0.2.0

func (r ObjectListRequest) Query() url.Values

func (*ObjectListRequest) Select added in v0.2.0

func (r *ObjectListRequest) Select(bind *pg.Bind, op pg.Op) (string, error)

func (ObjectListRequest) String added in v0.2.0

func (r ObjectListRequest) String() string

type ObjectMeta

type ObjectMeta struct {
	ContentType string `json:"type,omitempty"`
	Meta        []Meta `json:"meta,omitempty"`
}

ObjectMeta represents the metadata of an object, which can be updated.

func (ObjectMeta) Update added in v0.2.0

func (m ObjectMeta) Update(bind *pg.Bind) error

type ObjectTouch added in v0.2.0

type ObjectTouch ObjectKey

func (ObjectTouch) Select added in v0.2.0

func (k ObjectTouch) Select(bind *pg.Bind, op pg.Op) (string, error)

type PruneObjectsRequest added in v0.2.25

type PruneObjectsRequest struct {
	ObjectListRequest
	LastIndexed *time.Time `json:"last_indexed,omitempty"`
}

func (*PruneObjectsRequest) Select added in v0.2.25

func (r *PruneObjectsRequest) Select(bind *pg.Bind, op pg.Op) (string, error)

func (PruneObjectsRequest) String added in v0.2.25

func (r PruneObjectsRequest) String() string

type ReadObjectRequest

type ReadObjectRequest struct {
	ObjectKey
}

type SearchList added in v0.2.10

type SearchList struct {
	SearchListRequest
	Count uint64          `json:"count"`
	Body  []*SearchResult `json:"body"`
}

func (*SearchList) Scan added in v0.2.10

func (l *SearchList) Scan(row pg.Row) error

func (*SearchList) ScanCount added in v0.2.10

func (l *SearchList) ScanCount(row pg.Row) error

func (SearchList) String added in v0.2.10

func (r SearchList) String() string

type SearchListRequest added in v0.2.10

type SearchListRequest struct {
	Volumes []string `json:"volumes" help:"List of volumes to search"`
	Text    string   `json:"query" arg:"" name:"query" help:"Search query"`
	pg.OffsetLimit
}

func (SearchListRequest) Query added in v0.2.10

func (r SearchListRequest) Query() url.Values

func (*SearchListRequest) Select added in v0.2.10

func (r *SearchListRequest) Select(bind *pg.Bind, op pg.Op) (string, error)

func (SearchListRequest) String added in v0.2.10

func (r SearchListRequest) String() string

type SearchResult added in v0.2.10

type SearchResult struct {
	Title   string  `json:"title"`
	Summary string  `json:"summary"`
	Rank    float64 `json:"rank"`
	Object
}

func (SearchResult) Cell added in v0.2.10

func (r SearchResult) Cell(col int) string

func (SearchResult) Header added in v0.2.10

func (r SearchResult) Header() []string

func (*SearchResult) Scan added in v0.2.10

func (s *SearchResult) Scan(row pg.Row) error

func (SearchResult) String added in v0.2.10

func (r SearchResult) String() string

func (SearchResult) Width added in v0.2.10

func (r SearchResult) Width(col int) int

type Volume added in v0.2.0

type Volume struct {
	VolumeCreate
	Name                string     `json:"name,omitempty"`
	CreatedAt           time.Time  `json:"created_at,omitempty"`
	IndexedAt           *time.Time `json:"indexed_at,omitempty"`
	Objects             uint64     `json:"objects,omitempty"`
	LastIndexedObjectAt *time.Time `json:"last_indexed_object_at,omitempty"`
}

func (Volume) Cell added in v0.2.7

func (r Volume) Cell(col int) string

func (Volume) Header added in v0.2.7

func (r Volume) Header() []string

func (*Volume) Scan added in v0.2.0

func (v *Volume) Scan(row pg.Row) error

func (Volume) String added in v0.2.0

func (v Volume) String() string

func (Volume) Width added in v0.2.7

func (r Volume) Width(col int) int

type VolumeCreate added in v0.2.0

type VolumeCreate struct {
	URL string `json:"url,omitempty" arg:"" help:"URL of the volume to create"`
	VolumeMeta
}

func (VolumeCreate) Insert added in v0.2.0

func (v VolumeCreate) Insert(bind *pg.Bind) (string, error)

type VolumeList added in v0.2.0

type VolumeList struct {
	VolumeListRequest
	Count uint64    `json:"count,omitempty"`
	Body  []*Volume `json:"body,omitempty"`
}

func (*VolumeList) Scan added in v0.2.0

func (v *VolumeList) Scan(row pg.Row) error

func (*VolumeList) ScanCount added in v0.2.0

func (v *VolumeList) ScanCount(row pg.Row) error

func (VolumeList) String added in v0.2.0

func (v VolumeList) String() string

type VolumeListRequest added in v0.2.0

type VolumeListRequest struct {
	Enabled *bool `json:"enabled,omitempty" help:"returns only enabled or disabled volumes" negatable:""`
	Stale   bool  `json:"stale,omitzero" help:"returns volumes that need to be re-indexed" negatable:""`
	pg.OffsetLimit
}

func (VolumeListRequest) Query added in v0.2.7

func (r VolumeListRequest) Query() url.Values

func (*VolumeListRequest) Select added in v0.2.0

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

func (VolumeListRequest) String added in v0.2.0

func (v VolumeListRequest) String() string

type VolumeMeta added in v0.2.0

type VolumeMeta struct {
	Enabled    *bool          `json:"enabled,omitempty" negatable:""`
	IndexDelta *time.Duration `json:"delta,omitempty"` // if non-zero, forces a full re-index if the last index is older than this duration
}

func (VolumeMeta) Insert added in v0.2.0

func (v VolumeMeta) Insert(bind *pg.Bind) (string, error)

func (VolumeMeta) String added in v0.2.0

func (v VolumeMeta) String() string

func (VolumeMeta) Update added in v0.2.0

func (v VolumeMeta) Update(bind *pg.Bind) error

type VolumeName added in v0.2.0

type VolumeName string

func (VolumeName) Select added in v0.2.0

func (v VolumeName) Select(bind *pg.Bind, op pg.Op) (string, error)

type VolumeTouch added in v0.2.0

type VolumeTouch string

func (VolumeTouch) Select added in v0.2.0

func (v VolumeTouch) Select(bind *pg.Bind, op pg.Op) (string, error)

Jump to

Keyboard shortcuts

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