Documentation ¶
Overview ¶
Package impl provides default and base implementations for specialized storage service implementations like gdrive.
Index ¶
- Constants
- 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.ReaderService, cache interf.Cache, ...) (interf.ReaderAt, error)
- func NewRamReaderAt(data []byte) interf.ReaderAt
- func NewRamService(cache interf.Cache, debugLvl uint8) interf.Service
- func NewReaderAt(file interf.File, service interf.ReaderService, cache interf.Cache, ...) (interf.ReaderAt, error)
- func NewSubReaderAt(file interf.File, service interf.ReaderService, cache interf.Cache, ...) (interf.ReaderAt, error)
- func NewZeroReaderAt() interf.ReaderAt
Constants ¶
const DebugHigh = 2
DebugHigh shows all debug messages.
const DebugLow = 1
DebugLow shows debug messages that happen very rarely during operation (to keep the log files small).
const DebugOff = 0
DebugOff deactivates all debug messages. Errors, warnings or information are still printed.
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.ReaderService, cache interf.Cache, debugLvl uint8) (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 NewRamReaderAt ¶ added in v1.1.3
NewRamReaderAt return a ReaderAt implementation that provides data from the ram ([]byte).
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.ReaderService, cache interf.Cache, debugLvl uint8) (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.
func NewSubReaderAt ¶ added in v1.1.1
func NewSubReaderAt(file interf.File, service interf.ReaderService, cache interf.Cache, debugLvl uint8, off, n int64) (interf.ReaderAt, error)
NewSubReaderAt creates a new interf.ReaderAt object for random read access to the file. This implementation enables the ReaderAt methods to a part of a file. No connections are made before the first call of ReadAt(). Is cache = nil, the cache is disabled. The offset off is the part start point and n the part size.
func NewZeroReaderAt ¶ added in v1.1.2
NewZeroReaderAt is a dummy ReaderAt with no data.
Types ¶
This section is empty.