Documentation ¶
Overview ¶
Package impl provides default and base implementations for specialized storage service implementations like gdrive.
Index ¶
- func FileByAttr(files []interf.File, name string, size int64, md5 string) (interf.File, error)
- func FileById(files map[string]interf.File, id string) (interf.File, error)
- func FileByName(files []interf.File, name string) (interf.File, error)
- func InitDemo(s interf.Service) error
- func NewCache(cacheSizeMB int) interf.Cache
- func NewFile(id, name string, modTime, size int64, md5 string) interf.File
- func NewFiles(byId map[string]interf.File) interf.Files
- func NewMultiReaderAt(files []interf.File, service interf.Service, cache interf.Cache, debugLog bool) (interf.ReaderAt, error)
- func NewRamService(cache interf.Cache, debugLog bool) interf.Service
- func NewReaderAt(file interf.File, service interf.Service, cache interf.Cache, debugLog bool) (interf.ReaderAt, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileByAttr ¶
FileByAttr returns the first file found with the requested attributes. If the parameter md5 is empty, this attribute is not considered in the search. If no file is found, the os.ErrNotExist error is returned. The data source is the specified list of files (attribute files).
func FileById ¶
FileById returns the file with the requested file id. If no file is found, the os.ErrNotExist error is returned. The data source is the specified list of files (attribute files).
func FileByName ¶
FileByName returns the latest (File.ModTime) file found with the requested name. If no file is found, the os.ErrNotExist error is returned. The data source is the specified list of files (attribute files).
func InitDemo ¶
InitDemo creates the following test files:
- over 1000 small test files Name: small-test-file-%d.dat Data: text == filename
- 150 MB big test file (150*1024*1024 + 1 byte) Name: big-test-file-150.dat Data: random bytes MD5: 4DB84342E76FC08B993C528E2C2CDC6A
- ...
func NewCache ¶
func NewCache(cacheSizeMB int) interf.Cache
NewCache return the default implementation of interf.Cache. cacheSizeMB can't be less than 17 (min. 1024 * SectorSize =~ 17 MB).
func NewFile ¶
NewFile return the default implementation of interf.File. This encapsulates the given data.
func NewFiles ¶
NewFiles return the default implementation of interf.Files. If the map is nil, a valid empty map is generated.
func NewMultiReaderAt ¶
func NewMultiReaderAt(files []interf.File, service interf.Service, cache interf.Cache, debugLog bool) (interf.ReaderAt, error)
NewMultiReader combine two or more ReaderAt and behave like a normal ReaderAT for a single file. All files except the last file must be the same size. There must be at least two or more files!
func NewRamService ¶
NewRamService return the RAM implementation of interf.Service. The data are only in RAM. This implementation is mainly for testing.
func NewReaderAt ¶
func NewReaderAt(file interf.File, service interf.Service, cache interf.Cache, debugLog bool) (interf.ReaderAt, error)
NewReaderAt creates a new interf.ReaderAt object for random read access to the file. No connections are made before the first call of ReadAt(). Is cache = nil, the cache is disabled.
Types ¶
This section is empty.