Documentation ¶
Index ¶
- Variables
- type File
- type FileMeta
- type FileSystem
- func (f *FileSystem) Delete(ctx context.Context, name string) error
- func (f *FileSystem) Open(name string) (fs.File, error)
- func (f *FileSystem) OpenVersion(ctx context.Context, name string, version int64) (*File, error)
- func (f *FileSystem) Put(ctx context.Context, meta *FileMeta, hash blob.Hash) error
- func (f *FileSystem) ReadDir(name string) ([]fs.DirEntry, error)
- func (f *FileSystem) Stat(name string) (fs.FileInfo, error)
- func (f *FileSystem) Tenant() *tenant.ID
- type Server
- type Store
Constants ¶
This section is empty.
Variables ¶
var Set = wire.NewSet( ProvideStore, wire.Struct(new(Server), "*"), wire.Bind(new(file.FilesServer), new(*Server)), )
Set is used by wire.
Functions ¶
This section is empty.
Types ¶
type File ¶
A File associates an open Blob with additional metadata.
type FileMeta ¶
type FileMeta struct {
CTime, MTime time.Time
Meta map[string]string
Path string
Tenant *tenant.ID
Version int64
}
FileMeta describes file-like data other than the file's size.
type FileSystem ¶
type FileSystem struct {
// contains filtered or unexported fields
}
FileSystem provides multi-tenant access to named files.
func (*FileSystem) Delete ¶
func (f *FileSystem) Delete(ctx context.Context, name string) error
Delete ensures that no file exists with the given name.
func (*FileSystem) Open ¶
func (f *FileSystem) Open(name string) (fs.File, error)
Open implements fs.FS and simply wraps OpenVersion. If there is no file with that path, Open will look instead to see if there are any files with that path prefix. If so, it will return a File that represents a directory listing.
func (*FileSystem) OpenVersion ¶
OpenVersion returns an open handle to the named file. If version <= 0, the latest version of the file will be returned.
func (*FileSystem) Put ¶
Put creates or updates a file that is associated with the given content hash. The FileMeta will be updated by this call.
func (*FileSystem) ReadDir ¶
func (f *FileSystem) ReadDir(name string) ([]fs.DirEntry, error)
ReadDir implements fs.ReadDirFS.
func (*FileSystem) Stat ¶
func (f *FileSystem) Stat(name string) (fs.FileInfo, error)
Stat implements fs.StatFS.
func (*FileSystem) Tenant ¶
func (f *FileSystem) Tenant() *tenant.ID
Tenant returns the tenant associated with the FileSystem.
type Server ¶
type Server struct { Config *config.Config DB *pgxpool.Pool FS *Store file.UnsafeFilesServer `wire:"-"` // contains filtered or unexported fields }
Server implements the file.FilesServer interface.
func (*Server) List ¶
func (s *Server) List(ctx context.Context, req *file.ListRequest) (*file.ListResponse, error)
List implements file.FilesServer.
func (*Server) Retrieve ¶
func (s *Server) Retrieve( ctx context.Context, req *file.RetrievalRequest, ) (*file.RetrievalResponse, error)
Retrieve implements file.FilesServer.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a factory for FileSystem instances.
func ProvideStore ¶
func ProvideStore( ctx context.Context, blobs *blob.Store, config *config.Config, db *pgxpool.Pool, logger *log.Logger, ) (*Store, func(), error)
ProvideStore is called by wire.
func (*Store) FileSystem ¶
func (s *Store) FileSystem(tenant *tenant.ID) *FileSystem
FileSystem returns a filesystem abstraction around the store.