Documentation
¶
Index ¶
- Constants
- Variables
- func MatchesContentType(contentType, filter string) bool
- type Artwork
- type ArtworkInfo
- type ArtworkInfoKey
- type ArtworkKey
- type ArtworkMeta
- type ArtworkUploadRequest
- type CreateObjectRequest
- type DeleteObjectRequest
- type DeleteObjectsRequest
- type DeleteObjectsResponse
- type GetArtworkRequest
- type GetObjectRequest
- type LLMProvider
- type LLMProviderCreate
- type LLMProviderList
- type LLMProviderListRequest
- type LLMProviderMeta
- type LLMProviderName
- type Meta
- type Metadata
- type MetadataCreate
- type MetadataKV
- type MetadataKey
- type MetadataList
- type MetadataListRequest
- type MetadataMeta
- type MetadataQueryRequest
- type Object
- type ObjectArtwork
- type ObjectAttr
- type ObjectCreate
- type ObjectKey
- type ObjectList
- type ObjectListFilters
- type ObjectListIterator
- type ObjectListRequest
- type ObjectMeta
- type ObjectTouch
- type PruneObjectsRequest
- type ReadObjectRequest
- type SearchList
- type SearchListRequest
- type SearchResult
- type Volume
- type VolumeCreate
- type VolumeList
- type VolumeListRequest
- type VolumeMeta
- type VolumeName
- type VolumeTouch
Constants ¶
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.
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" )
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 ¶
var Objects string
var Queries string
Functions ¶
func MatchesContentType ¶ added in v0.2.20
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
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.
type ArtworkInfoKey ¶ added in v0.2.16
type ArtworkInfoKey ArtworkKey
ArtworkInfoKey selects artwork metadata only (no binary data)
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
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
type ArtworkUploadRequest ¶ added in v0.2.16
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) 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) 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) 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
type LLMProviderName ¶ added in v0.2.10
type LLMProviderName string
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.
type Metadata ¶ added in v0.1.2
type Metadata struct {
Key string `json:"key,omitempty"`
IndexedAt time.Time `json:"indexed_at,omitzero"`
MetadataCreate
}
type MetadataCreate ¶ added in v0.2.0
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) String ¶ added in v0.2.0
func (m MetadataKV) String() string
type MetadataKey ¶ added in v0.2.0
type MetadataKey string
type MetadataList ¶ added in v0.2.0
type MetadataList struct {
MetadataListRequest
Count uint64 `json:"count"`
Body []*Metadata `json:"body"`
}
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) 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
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) 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.
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) String ¶ added in v0.2.16
func (o ObjectArtwork) String() string
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
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.
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) 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) 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.
type ObjectTouch ¶ added in v0.2.0
type ObjectTouch ObjectKey
type PruneObjectsRequest ¶ added in v0.2.25
type PruneObjectsRequest struct {
ObjectListRequest
LastIndexed *time.Time `json:"last_indexed,omitempty"`
}
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) 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) 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) 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 VolumeCreate ¶ added in v0.2.0
type VolumeCreate struct {
URL string `json:"url,omitempty" arg:"" help:"URL of the volume to create"`
VolumeMeta
}
type VolumeList ¶ added in v0.2.0
type VolumeList struct {
VolumeListRequest
Count uint64 `json:"count,omitempty"`
Body []*Volume `json:"body,omitempty"`
}
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) 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
type VolumeName ¶ added in v0.2.0
type VolumeName string