storage

package
v0.0.0-...-cf45389 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data interface {
	CreateFile(string, time.Time) (uuid.UUID, error)
	CreateFileWithID(string, time.Time, uuid.UUID) error
	CreateFileWithTags(string, time.Time, []string) (uuid.UUID, error)
	CreateFileWithIDAndTags(string, time.Time, uuid.UUID, []string) error

	RemoveFile(uuid.UUID) error

	FindFilesWithDate(time.Time) ([]*records.File, error)
	FindFilesWithTags(tagNames []string) ([]*records.File, error)
	FindFilesWithIdPrefix(idPrefix string) ([]*records.File, error)

	GetFileWithDate(string, time.Time) (*records.File, error)

	GetFileYears() ([]int, error)
	GetFileMonths(int) ([]int, error)
	GetFileDays(int, int) ([]int, error)

	AllFiles() (records.FileIterator, error)
	GetFile(id uuid.UUID) (*records.File, error)
	GetFileByHash(hash string) (*records.File, error)
	UpdateFile(*records.File) error

	UpdateFileHash(uuid.UUID, string) error
	UpdateFileDate(uuid.UUID, string, time.Time) error

	AllTags() (records.TagIterator, error)
	GetTags([]string) ([]*records.Tag, error)
	GetTagsForFile(uuid.UUID) (records.TagIterator, error)
	FindTagByName(string) (*records.Tag, error)
	CreateTags([]string) ([]uuid.UUID, error)
	UpdateFileTags(id uuid.UUID, addedTags []string, removedTags []string) error

	FindMetadataByHash(hash string) (*records.FileMetadata, error)
	CreateMetadataWithID(string, uint64, uuid.UUID) error
}

type File

type File interface {
	OpenFile(uuid.UUID) (OpenFile, error)
	OpenTempFile(uuid.UUID) (OpenFile, error)

	ReadFile(filePath string) (io.ReadCloser, error)
	ReadFileFromOffset(filePath string, offset uint64) (io.ReadCloser, error)
}

type OpenFile

type OpenFile interface {
	io.ReadWriteSeeker

	Flush() error

	// Close closes a file opened for reading
	Close() error

	// Claim closes a file opened for writing and keeps it in
	// persistent storage with the given ID
	Claim(uuid.UUID) error
	// Drop closes a file opened for writing and removes it
	// from storage
	Drop() error
}

Directories

Path Synopsis
v1
data
file

Jump to

Keyboard shortcuts

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