filecache

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache represents a oc10-style file cache.

func New

func New(driver string, sqldb *sql.DB) (*Cache, error)

New returns a new Cache instance connecting to the given sql.DB.

func NewMysql

func NewMysql(dsn string) (*Cache, error)

NewMysql returns a new Cache instance connecting to a MySQL database.

func (*Cache) Copy

func (c *Cache) Copy(storage interface{}, sourcePath, targetPath string) (int, error)

Copy creates a copy of the specified entry at the target path.

func (*Cache) CreateStorage

func (c *Cache) CreateStorage(id string) (int, error)

CreateStorage creates a new storage and returns its numeric id.

func (*Cache) Delete

func (c *Cache) Delete(storage interface{}, user, path, trashPath string) error

Delete removes the specified storage/path from the cache.

func (*Cache) DeleteRecycleItem

func (c *Cache) DeleteRecycleItem(user, path string, timestamp int) error

DeleteRecycleItem deletes the specified item from the trash.

func (*Cache) EmptyRecycle

func (c *Cache) EmptyRecycle(user string) error

EmptyRecycle clears the recycle bin for the given user.

func (*Cache) Get

func (c *Cache) Get(s interface{}, p string) (*File, error)

Get returns the cache entry for the specified storage/path.

func (*Cache) GetNumericStorageID

func (c *Cache) GetNumericStorageID(id string) (int, error)

GetNumericStorageID returns the database id for the given storage.

func (*Cache) GetRecycleItem

func (c *Cache) GetRecycleItem(user, path string, timestamp int) (*TrashItem, error)

GetRecycleItem returns the specified recycle item.

func (*Cache) GetStorageOwner

func (c *Cache) GetStorageOwner(numericID interface{}) (string, error)

GetStorageOwner returns the username of the owner of the given storage.

func (*Cache) GetStorageOwnerByFileID

func (c *Cache) GetStorageOwnerByFileID(numericID interface{}) (string, error)

GetStorageOwnerByFileID returns the username of the owner of the given entry.

func (*Cache) InsertOrUpdate

func (c *Cache) InsertOrUpdate(storage interface{}, data map[string]interface{}, allowEmptyParent bool) (int, error)

InsertOrUpdate creates or updates a cache entry.

func (*Cache) List

func (c *Cache) List(storage interface{}, p string) ([]*File, error)

List returns the list of entries below the given path.

func (*Cache) Move

func (c *Cache) Move(storage interface{}, sourcePath, targetPath string) error

Move moves the specified entry to the target path.

func (*Cache) Path

func (c *Cache) Path(id interface{}) (string, error)

Path returns the path for the specified entry.

func (*Cache) Permissions

func (c *Cache) Permissions(storage interface{}, p string) (*provider.ResourcePermissions, error)

Permissions returns the permissions for the specified storage/path.

func (*Cache) Purge

func (c *Cache) Purge(storage interface{}, path string) error

Purge removes the specified storage/path from the cache without putting it into the trash.

func (*Cache) PurgeRecycleItem

func (c *Cache) PurgeRecycleItem(user, path string, timestamp int, isVersionFile bool) error

PurgeRecycleItem deletes the specified item from the filecache and the trash.

func (*Cache) SetEtag

func (c *Cache) SetEtag(storage interface{}, path, etag string) error

SetEtag set a new etag for the specified item.

type File

type File struct {
	ID              int
	Storage         int
	Parent          int
	MimePart        int
	MimeType        int
	MimeTypeString  string
	Size            int
	MTime           int
	StorageMTime    int
	UnencryptedSize int
	Permissions     int
	Encrypted       bool
	Path            string
	Name            string
	Etag            string
	Checksum        string
}

File represents an entry of the file cache.

type Scannable

type Scannable interface {
	Scan(...interface{}) error
}

Scannable describes the interface providing a Scan method.

type TrashItem

type TrashItem struct {
	ID        int
	Name      string
	User      string
	Path      string
	Timestamp int
}

TrashItem represents a trash item of the file cache.

Jump to

Keyboard shortcuts

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