Documentation ¶
Index ¶
- Constants
- Variables
- func ConsolidateHashes(pklPath, invalidPath string) (map[string]string, error)
- func GetFileMTime(filePath string) (int64, error)
- func HashCleanupListDir(hashDir string, reclaimAge int64) ([]string, error)
- func InvalidateHash(hashDir string) error
- func IsFileNotExist(path string) bool
- func LoadInvalidSuffixes(invalidPath string) ([]string, error)
- func LoadPklHashes(pklPath string) (map[string]string, error)
- func ObjectFiles(directory string) (string, string)
- func ObjectMetadata(dataFile string, metaFile string) (map[string]string, error)
- func OpenObjectMetadata(fd uintptr, metaFile string) (map[string]string, error)
- func PolicyDir(policy int) string
- func QuarantineHash(hashDir string) error
- func RawReadMetadata(fileNameOrFd interface{}) ([]byte, error)
- func RawWriteMetadata(fd uintptr, buf []byte) error
- func ReadMetadata(fileNameOrFd interface{}) (map[string]string, error)
- func RecalculateSuffixHash(suffixDir string, reclaimAge int64) (string, error)
- func SaveHashesPkl(hashes map[string]string, pklPath, tempDir, partitionDir string) error
- func SwiftEngineConstructor(config conf.Config, policy *conf.Policy, flags *flag.FlagSet, ...) (engine.ObjectEngine, error)
- func TempDir(driveRoot string, device string) string
- func UnPolicyDir(dir string) (int, error)
- func WriteMetadata(fd uintptr, v map[string]string) error
- type SwiftEngine
- type SwiftObject
- func (o *SwiftObject) Close() error
- func (o *SwiftObject) Commit(metadata map[string]string) error
- func (o *SwiftObject) CommitMeta(metadata map[string]string) error
- func (o *SwiftObject) ContentLength() int64
- func (o *SwiftObject) Copy(dsts ...io.Writer) (written int64, err error)
- func (o *SwiftObject) CopyRange(w io.Writer, start int64, end int64) (int64, error)
- func (o *SwiftObject) Delete(metadata map[string]string) error
- func (o *SwiftObject) Exists() bool
- func (o *SwiftObject) Metadata() map[string]string
- func (o *SwiftObject) Quarantine() error
- func (o *SwiftObject) Repr() string
- func (o *SwiftObject) SetData(size int64) (io.Writer, error)
Constants ¶
const ( ONE_WEEK = 604800 METADATA_CHUNK_SIZE = 65536 HASH_FILE = "hashes.pkl" HASH_INVALIDATIONS_FILE = "hashes.invalid" )
Variables ¶
var ( ErrLockPath = errors.New("Error locking path") ErrPathNotDir = errors.New("Path is not a directory") ErrMalformedPickleFile = errors.New("pickle file is malformed") ErrTempFileNotCreated = errors.New("unable to create temp file") ErrTimestampNotFoundInMeta = errors.New("unable to find x-timestamp") ErrMetaCorruption = errors.New("metadata corrupted") ErrFileCorruption = errors.New("file corrupted") ErrConfigNotLoaded = errors.New("unable to read config") ErrDriveFull = errors.New("Drive Full") )
Functions ¶
func ConsolidateHashes ¶
func GetFileMTime ¶
func HashCleanupListDir ¶
func InvalidateHash ¶
InvalidateHash invalidates the hashdir's suffix hash, indicating it needs to be recalculated.
func IsFileNotExist ¶
func LoadInvalidSuffixes ¶
Load hash list from hashes.invalid
func LoadPklHashes ¶
Load hash list from hashes.pkl TODO: need to remove corrupted hashes.pkl file
func ObjectFiles ¶
func ObjectMetadata ¶
func OpenObjectMetadata ¶
func QuarantineHash ¶
func RawReadMetadata ¶
func RawWriteMetadata ¶
func ReadMetadata ¶
func RecalculateSuffixHash ¶
func SaveHashesPkl ¶
func SwiftEngineConstructor ¶
func SwiftEngineConstructor(config conf.Config, policy *conf.Policy, flags *flag.FlagSet, wg *sync.WaitGroup) (engine.ObjectEngine, error)
creates a SwiftEngine given the object server configs.
func UnPolicyDir ¶
Types ¶
type SwiftEngine ¶
type SwiftEngine struct {
// contains filtered or unexported fields
}
func (*SwiftEngine) Close ¶
func (f *SwiftEngine) Close() error
type SwiftObject ¶
type SwiftObject struct {
// contains filtered or unexported fields
}
SwiftObject implements an Object that is compatible with Swift's object server.
func (*SwiftObject) Close ¶
func (o *SwiftObject) Close() error
Close releases any resources used by the instance of SwiftObject
func (*SwiftObject) Commit ¶
func (o *SwiftObject) Commit(metadata map[string]string) error
Commit commits an open data file to disk, given the metadata.
func (*SwiftObject) CommitMeta ¶
func (o *SwiftObject) CommitMeta(metadata map[string]string) error
func (*SwiftObject) ContentLength ¶
func (o *SwiftObject) ContentLength() int64
ContentLength parses and returns the Content-Length for the object.
func (*SwiftObject) Copy ¶
func (o *SwiftObject) Copy(dsts ...io.Writer) (written int64, err error)
Copy copies all data from the underlying .data file to the given writers.
func (*SwiftObject) CopyRange ¶
CopyRange copies data in the range of start to end from the underlying .data file to the writer.
func (*SwiftObject) Delete ¶
func (o *SwiftObject) Delete(metadata map[string]string) error
Delete deletes the object.
func (*SwiftObject) Exists ¶
func (o *SwiftObject) Exists() bool
Exists returns true if the object exists, that is if it has a .data file.
func (*SwiftObject) Metadata ¶
func (o *SwiftObject) Metadata() map[string]string
Metadata returns the object's metadata.
func (*SwiftObject) Quarantine ¶
func (o *SwiftObject) Quarantine() error
Quarantine removes the object's underlying files to the Quarantined directory on the device.
func (*SwiftObject) Repr ¶
func (o *SwiftObject) Repr() string
Repr returns a string that identifies the object in some useful way, used for logging.