database

package
v0.0.0-...-ef09f56 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltDao

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

BoltDao provides caching of file information using a bbold database.

func OpenDb

func OpenDb(fileName string, getFiles func() (chan FileOrError, error)) (*BoltDao, error)

OpenDb opens the specified data file. If the database is empty then getFiles is used to populate it.

func (*BoltDao) AddOrUpdate

func (dao *BoltDao) AddOrUpdate(remoteID string, name string, mimeType string, size uint64, md5checksum *string,
	parentIDs []string, lastModified string, localID *string) error

AddOrUpdate adds or updates the records for a file.

func (*BoltDao) Close

func (dao *BoltDao) Close() error

Close closes the bbolt database.

func (*BoltDao) FindByID

func (dao *BoltDao) FindByID(finfo FileInfo) (rf *RemoteFile)

FindByID looks up a file record using the local ID.

func (*BoltDao) FindByPath

func (dao *BoltDao) FindByPath(remotePath string) *RemoteFile

FindByPath looks up a file record using the remote path.

type FileInfo

type FileInfo interface {
	ID() string
	Size() uint64
}

type FileOrError

type FileOrError struct {
	File  *RemoteFile
	Error error
}

FileOrError contains either a cache entry or an error.

type RemoteFile

type RemoteFile struct {
	Name         string
	MimeType     string
	Size         uint64
	Md5Checksum  *string
	ParentIDs    []string // remote IDs of the file's parents
	LastModified *string
	LocalID      *string
	RemoteID     *string
}

Cache record for a remote file.

func NewRemoteFile

func NewRemoteFile(name string, mimeType string, size uint64, md5Checksum string, parentIDs []string, modifiedTime string, localID string, remoteID string) *RemoteFile

func (*RemoteFile) ModTime

func (rf *RemoteFile) ModTime() time.Time

Jump to

Keyboard shortcuts

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