Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActionOf ¶ added in v0.5.0
ActionOf returns what an action is, without running it, as it's listed, such as over HTTP
func HTTPErr ¶ added in v0.1.2
HTTPErr translates an error into an error wrapping a HTTP status code
func PatchValues ¶ added in v0.3.0
PatchValues returns a copy of the options, changed by the patch: each key of the patch replaces the option's values with its own, or, when it has none, removes the option, so it's the default
func ValidActionName ¶ added in v0.5.0
ValidActionName returns true when the name of an action is valid: of letters, digits, "_" and "-", of up to 64 characters, as a tool's name is
Types ¶
type Action ¶ added in v0.5.0
type Action interface {
// Name is the action's identifier, in snake_case, such as create_event,
// which is a tool's name as it is (see ValidActionName)
Name() string
// Title is a short label of the action, such as "Create event"
Title() string
// Description is what the action does, for people and models
Description() string
// Input is the JSON schema of the action's input
Input() *jsonschema.Schema
// Run does the action, with its input, which is JSON of its schema, and
// returns the object it created or changed
Run(ctx context.Context, input json.RawMessage) (*schema.Object, error)
}
Action is something a backend can do, beyond reading and writing its objects, such as creating a calendar event, which a Filer returns of Actions. It maps onto an LLM tool: its name, description and input are a tool's, and the object it returns is the tool's result.
type Err ¶ added in v0.1.2
type Err int
Errors
const ( ErrSuccess Err = iota ErrNotFound ErrBadParameter ErrNotImplemented ErrConflict ErrInternalServerError ErrForbidden ErrNotModified ErrCreated // not a failure: the object was created, rather than replaced ErrPreconditionFailed // a condition of the request isn't met, such as replacing an object which doesn't exist ErrUnprocessableContent // the request can't be processed, such as creating an object whose name is skipped ErrNotAuthorized // the backend needs its user to sign in, such as to their Google account )
func (Err) HTTP ¶ added in v0.1.2
func (e Err) HTTP() httpresponse.Err
type Filer ¶ added in v0.3.0
type Filer interface {
// URL returns the filer URL. The scheme, host (bucket/name),
// and path (prefix/directory) identify the storage location. Query
// parameters carry useful non-credential details: region, endpoint, anonymous, readonly, etc.
URL() *url.URL
// Description returns what the volume is, such as "Folder /mnt/media",
// or "S3 bucket photos in eu-west-1", which is its URL's description
// option, when it's set, and is otherwise the backend's of it
Description() string
// Actions returns what the backend can do, beyond reading and writing
// its objects, such as creating a calendar event, or nil, such as for a
// filesystem, whose objects are all it has
Actions() []Action
// Clone returns a new filer of the same storage, with the options of the
// filer, changed by the patch (see PatchValues), which is nil to keep
// them, from what the filer has, rather than its URL, which doesn't have
// its credentials. The filer isn't changed, and the clone is checked as a
// new filer is, such as a bucket being accessible. The registry clones a
// volume's filer to change its options, and to open it again when
// watching it fails.
Clone(context.Context, url.Values) (Filer, error)
// Create object in the filer, and return it, which is at the request's
// path, unless the backend names it, such as a Google task, whose id
// Google gives it
CreateObject(context.Context, schema.CreateObjectRequest) (*schema.Object, error)
// Get object metadata from the filer
GetObject(context.Context, schema.GetObjectRequest) (*schema.Object, error)
// Read object content from the filer, by calling the returned function,
// with the object's metadata
ReadObject(context.Context, schema.GetObjectRequest) (ReadObjectFunc, *schema.Object, error)
// List objects in the filer. Call Next on the returned iterator until
// io.EOF is returned. Caller must close the returned iterator.
ListObjects(context.Context, schema.ListObjectsRequest) (schema.ListObjectsIterator, error)
// Delete an object in the filer, and return the deleted object. A
// directory is only deleted when the request is recursive, in which case
// every object beneath it is deleted too. The root of a volume cannot be
// deleted.
DeleteObjects(context.Context, schema.DeleteObjectsRequest) (*schema.DeleteObjectsResponse, error)
// Watch for changes to objects, sending each to the channel, until the
// context is cancelled. The first is a rescan of the root, once the
// objects are watched, so a caller which lists them then misses no
// change. The channel isn't closed. It will return
// filer.ErrNotImplemented if the filer backend does not support watching objects.
WatchObjects(context.Context, chan<- schema.Event) error
}
Filer is the interface for storing files and objects. A filer which holds resources, such as a client, or a watch, also implements io.Closer, which its owner, such as the registry, calls, rather than those it's given to.
type Opts ¶ added in v0.3.0
type Opts struct {
// Tracer traces the requests of the backend to other services, such as
// S3, when it's set
Tracer trace.Tracer
// Credentials are the server's, which a backend looks up of the names in
// its URL, such as S3_SECRET, or are its sign-in, such as Google's, when
// it's set
Credentials credential.CredentialProvider
// ClientOpts are the options of the clients of a backend which calls
// other services over HTTP, such as Google's, which it's given as they
// are, such as a user agent, a tracer, of client.OptTracer, a trace, or
// a timeout
ClientOpts []client.ClientOpt
}
Opts are the options of a backend, which the registry passes to it when it's created
type ReadObjectFunc ¶ added in v0.3.0
ReadObjectFunc reads an object's content: it opens the object, calls the function with a reader of the content, and closes the object when the function returns. The reader returns an error once the context is cancelled, or the filer is closed. Returns the function's error, or the error opening or closing the object.
Directories
¶
| Path | Synopsis |
|---|---|
|
backend
|
|
|
fs
Package fs provides the filesystem interface for managing objects in directories.
|
Package fs provides the filesystem interface for managing objects in directories. |
|
fs/fsevents
Package fsevents watches a directory, and everything beneath it, for files and directories which are created, updated and deleted, using the efficient mechanism of each platform: FSEvents on macOS, ReadDirectoryChangesW on Windows, and inotify on Linux.
|
Package fsevents watches a directory, and everything beneath it, for files and directories which are created, updated and deleted, using the efficient mechanism of each platform: FSEvents on macOS, ReadDirectoryChangesW on Windows, and inotify on Linux. |
|
google
Package google has filers of Google's services, such as Tasks, whose requests are with the clients of package httpclient, so a request which isn't authorized returns an AuthError, which says a sign-in is needed.
|
Package google has filers of Google's services, such as Tasks, whose requests are with the clients of package httpclient, so a request which isn't authorized returns an AuthError, which says a sign-in is needed. |
|
google/httpclient
Package httpclient has clients of Google's APIs, with go-auth's auth/httpclient, so a request which isn't authorized returns an AuthError, which says a sign-in is needed.
|
Package httpclient has clients of Google's APIs, with go-auth's auth/httpclient, so a request which isn't authorized returns an AuthError, which says a sign-in is needed. |
|
internal/blocks
Package blocks reads a file at offsets, of the blocks of it which are requested, the last of which are kept, so a parser's reads, which are scattered across a file, such as a PDF's objects, are of few requests
|
Package blocks reads a file at offsets, of the blocks of it which are requested, the last of which are kept, so a parser's reads, which are scattered across a file, such as a PDF's objects, are of few requests |
|
rss
Package rss is a backend of an RSS feed, of rss://<name>/<host>/<path>, whose items are files, of their days, /YYYY/YYYY-MM/DD-<title>.html, each an HTML page of the item, with its title, author, date and link as its metadata, and its enclosure, such as a podcast's episode, too.
|
Package rss is a backend of an RSS feed, of rss://<name>/<host>/<path>, whose items are files, of their days, /YYYY/YYYY-MM/DD-<title>.html, each an HTML page of the item, with its title, author, date and link as its metadata, and its enclosure, such as a podcast's episode, too. |
|
s3
Package s3 is a filer of the objects in an S3 bucket, or one which is compatible, beneath a prefix
|
Package s3 is a filer of the objects in an S3 bucket, or one which is compatible, beneath a prefix |
|
s3/seaweedfs
Package seaweedfs watches the changes to the objects of an S3 bucket of a SeaweedFS filer, by subscribing to the changes to the filer's metadata, with its gRPC service
|
Package seaweedfs watches the changes to the objects of an S3 bucket of a SeaweedFS filer, by subscribing to the changes to the filer's metadata, with its gRPC service |
|
cmd
|
|
|
filer
command
|
|
|
Package frontend is go-filer's web UI: its modules, such as Files, which the package @mutablelogic/go-filer exports, and the server's app, which make builds into app/dist, and which a command built with the "frontend" tag embeds, as EmbedFS.
|
Package frontend is go-filer's web UI: its modules, such as Files, which the package @mutablelogic/go-filer exports, and the server's app, which make builds into app/dist, and which a command built with the "frontend" tag embeds, as EmbedFS. |
|
cmd
Package cmd serves the web UI, and the server's configuration, which it reads, beside the API, when the server is built with the "frontend" tag, which embeds the UI, once it's built, with npm, into frontend/app/dist, which make does.
|
Package cmd serves the web UI, and the server's configuration, which it reads, beside the API, when the server is built with the "frontend" tag, which embeds the UI, once it's built, with npm, into frontend/app/dist, which make does. |
|
Package indexer is a filer which wraps another, and keeps an index of its folders, in a Store, which it follows the backend's changes in, so its folder tree is listed from the index, rather than the backend, which can be slow, such as a bucket, or a network mount.
|
Package indexer is a filer which wraps another, and keeps an index of its folders, in a Store, which it follows the backend's changes in, so its folder tree is listed from the index, rather than the backend, which can be slow, such as a bucket, or a network mount. |
|
Package metadata is the task which enriches the files of a volume which is indexed with index=metadata, with their metadata, of go-metadata: tags of audio and video, EXIF of photos, the titles of documents, movies and TV episodes on TMDB, recordings on AcoustID, and so on.
|
Package metadata is the task which enriches the files of a volume which is indexed with index=metadata, with their metadata, of go-metadata: tags of audio and video, EXIF of photos, the titles of documents, movies and TV episodes on TMDB, recordings on AcoustID, and so on. |
|
cmd
Package cmd is the flags of the metadata enrichment of a server, which it embeds, and composes into the registry of its volumes
|
Package cmd is the flags of the metadata enrichment of a server, which it embeds, and composes into the registry of its volumes |
|
Package schema is the types of the objects in a backend, which are the types of the filer's objects
|
Package schema is the types of the objects in a backend, which are the types of the filer's objects |
|
pg
Package pg is an index store in a Postgres database, which isn't implemented yet (#72): each of its methods returns ErrNotImplemented
|
Package pg is an index store in a Postgres database, which isn't implemented yet (#72): each of its methods returns ErrNotImplemented |
|
sqlite
Package sqlite is a store of volumes, and their indexes, in a SQLite database, which is created when it doesn't exist, or in memory, of sqlite.Memory, such as for tests
|
Package sqlite is a store of volumes, and their indexes, in a SQLite database, which is created when it doesn't exist, or in memory, of sqlite.Memory, such as for tests |
|
sqlite/schema
Package schema is the schema of the SQLite store: its tables, its queries, and the types which are read from, and written to, them
|
Package schema is the schema of the SQLite store: its tables, its queries, and the types which are read from, and written to, them |
|
test
Package test is the conformance tests of an index store, which each store runs, so they behave the same
|
Package test is the conformance tests of an index store, which each store runs, so they behave the same |

