Documentation ¶
Index ¶
- func NewFSRepository() storage.RepositoryBackend
- type FSRepository
- func (repository *FSRepository) CheckChunk(checksum [32]byte) (bool, error)
- func (repository *FSRepository) CheckObject(checksum [32]byte) (bool, error)
- func (repository *FSRepository) Close() error
- func (repository *FSRepository) Configuration() storage.RepositoryConfig
- func (repository *FSRepository) Create(location string, config storage.RepositoryConfig) error
- func (repository *FSRepository) DeleteChunk(checksum [32]byte) error
- func (repository *FSRepository) DeleteObject(checksum [32]byte) error
- func (repository *FSRepository) GetChunk(checksum [32]byte) ([]byte, error)
- func (repository *FSRepository) GetChunkRefCount(checksum [32]byte) (uint64, error)
- func (repository *FSRepository) GetChunkSize(checksum [32]byte) (uint64, error)
- func (repository *FSRepository) GetChunks() ([][32]byte, error)
- func (repository *FSRepository) GetFilesystem(indexID uuid.UUID) ([]byte, error)
- func (repository *FSRepository) GetIndex(indexID uuid.UUID) ([]byte, error)
- func (repository *FSRepository) GetIndexes() ([]uuid.UUID, error)
- func (repository *FSRepository) GetMetadata(indexID uuid.UUID) ([]byte, error)
- func (repository *FSRepository) GetObject(checksum [32]byte) ([]byte, error)
- func (repository *FSRepository) GetObjectRefCount(checksum [32]byte) (uint64, error)
- func (repository *FSRepository) GetObjectSize(checksum [32]byte) (uint64, error)
- func (repository *FSRepository) GetObjects() ([][32]byte, error)
- func (repository *FSRepository) Open(location string) error
- func (repository *FSRepository) PathChunk(checksum [32]byte) string
- func (repository *FSRepository) PathChunkBucket(checksum [32]byte) string
- func (repository *FSRepository) PathChunks() string
- func (repository *FSRepository) PathIndex(indexID uuid.UUID) string
- func (repository *FSRepository) PathIndexBucket(indexID uuid.UUID) string
- func (repository *FSRepository) PathIndexes() string
- func (repository *FSRepository) PathObject(checksum [32]byte) string
- func (repository *FSRepository) PathObjectBucket(checksum [32]byte) string
- func (repository *FSRepository) PathObjects() string
- func (repository *FSRepository) PathPurge() string
- func (repository *FSRepository) PathTransactions() string
- func (repository *FSRepository) Purge(indexID uuid.UUID) error
- func (repository *FSRepository) PutChunk(checksum [32]byte, data []byte) error
- func (repository *FSRepository) PutChunkSafe(checksum [32]byte, data []byte, link string) error
- func (repository *FSRepository) PutFilesystem(indexID uuid.UUID, data []byte) error
- func (repository *FSRepository) PutIndex(indexID uuid.UUID, data []byte) error
- func (repository *FSRepository) PutMetadata(indexID uuid.UUID, data []byte) error
- func (repository *FSRepository) PutObject(checksum [32]byte, data []byte) error
- func (repository *FSRepository) PutObjectSafe(checksum [32]byte, data []byte, link string) error
- func (repository *FSRepository) Transaction(indexID uuid.UUID) (storage.TransactionBackend, error)
- type FSTransaction
- func (transaction *FSTransaction) Commit() error
- func (transaction *FSTransaction) GetUuid() uuid.UUID
- func (transaction *FSTransaction) Path() string
- func (transaction *FSTransaction) PutFilesystem(data []byte) error
- func (transaction *FSTransaction) PutIndex(data []byte) error
- func (transaction *FSTransaction) PutMetadata(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFSRepository ¶
func NewFSRepository() storage.RepositoryBackend
Types ¶
type FSRepository ¶
type FSRepository struct { Cache *cache.Cache Repository string storage.RepositoryBackend // contains filtered or unexported fields }
func (*FSRepository) CheckChunk ¶
func (repository *FSRepository) CheckChunk(checksum [32]byte) (bool, error)
func (*FSRepository) CheckObject ¶
func (repository *FSRepository) CheckObject(checksum [32]byte) (bool, error)
func (*FSRepository) Close ¶
func (repository *FSRepository) Close() error
func (*FSRepository) Configuration ¶
func (repository *FSRepository) Configuration() storage.RepositoryConfig
func (*FSRepository) Create ¶
func (repository *FSRepository) Create(location string, config storage.RepositoryConfig) error
func (*FSRepository) DeleteChunk ¶
func (repository *FSRepository) DeleteChunk(checksum [32]byte) error
func (*FSRepository) DeleteObject ¶
func (repository *FSRepository) DeleteObject(checksum [32]byte) error
func (*FSRepository) GetChunk ¶
func (repository *FSRepository) GetChunk(checksum [32]byte) ([]byte, error)
func (*FSRepository) GetChunkRefCount ¶
func (repository *FSRepository) GetChunkRefCount(checksum [32]byte) (uint64, error)
func (*FSRepository) GetChunkSize ¶
func (repository *FSRepository) GetChunkSize(checksum [32]byte) (uint64, error)
func (*FSRepository) GetChunks ¶
func (repository *FSRepository) GetChunks() ([][32]byte, error)
func (*FSRepository) GetFilesystem ¶
func (repository *FSRepository) GetFilesystem(indexID uuid.UUID) ([]byte, error)
func (*FSRepository) GetIndex ¶
func (repository *FSRepository) GetIndex(indexID uuid.UUID) ([]byte, error)
func (*FSRepository) GetIndexes ¶
func (repository *FSRepository) GetIndexes() ([]uuid.UUID, error)
func (*FSRepository) GetMetadata ¶
func (repository *FSRepository) GetMetadata(indexID uuid.UUID) ([]byte, error)
func (*FSRepository) GetObject ¶
func (repository *FSRepository) GetObject(checksum [32]byte) ([]byte, error)
func (*FSRepository) GetObjectRefCount ¶
func (repository *FSRepository) GetObjectRefCount(checksum [32]byte) (uint64, error)
func (*FSRepository) GetObjectSize ¶
func (repository *FSRepository) GetObjectSize(checksum [32]byte) (uint64, error)
func (*FSRepository) GetObjects ¶
func (repository *FSRepository) GetObjects() ([][32]byte, error)
func (*FSRepository) Open ¶
func (repository *FSRepository) Open(location string) error
func (*FSRepository) PathChunk ¶
func (repository *FSRepository) PathChunk(checksum [32]byte) string
func (*FSRepository) PathChunkBucket ¶
func (repository *FSRepository) PathChunkBucket(checksum [32]byte) string
func (*FSRepository) PathChunks ¶
func (repository *FSRepository) PathChunks() string
func (*FSRepository) PathIndex ¶
func (repository *FSRepository) PathIndex(indexID uuid.UUID) string
func (*FSRepository) PathIndexBucket ¶
func (repository *FSRepository) PathIndexBucket(indexID uuid.UUID) string
func (*FSRepository) PathIndexes ¶
func (repository *FSRepository) PathIndexes() string
func (*FSRepository) PathObject ¶
func (repository *FSRepository) PathObject(checksum [32]byte) string
func (*FSRepository) PathObjectBucket ¶
func (repository *FSRepository) PathObjectBucket(checksum [32]byte) string
func (*FSRepository) PathObjects ¶
func (repository *FSRepository) PathObjects() string
func (*FSRepository) PathPurge ¶
func (repository *FSRepository) PathPurge() string
func (*FSRepository) PathTransactions ¶
func (repository *FSRepository) PathTransactions() string
func (*FSRepository) PutChunk ¶
func (repository *FSRepository) PutChunk(checksum [32]byte, data []byte) error
func (*FSRepository) PutChunkSafe ¶
func (repository *FSRepository) PutChunkSafe(checksum [32]byte, data []byte, link string) error
func (*FSRepository) PutFilesystem ¶
func (repository *FSRepository) PutFilesystem(indexID uuid.UUID, data []byte) error
func (*FSRepository) PutIndex ¶
func (repository *FSRepository) PutIndex(indexID uuid.UUID, data []byte) error
func (*FSRepository) PutMetadata ¶
func (repository *FSRepository) PutMetadata(indexID uuid.UUID, data []byte) error
func (*FSRepository) PutObject ¶
func (repository *FSRepository) PutObject(checksum [32]byte, data []byte) error
func (*FSRepository) PutObjectSafe ¶
func (repository *FSRepository) PutObjectSafe(checksum [32]byte, data []byte, link string) error
func (*FSRepository) Transaction ¶
func (repository *FSRepository) Transaction(indexID uuid.UUID) (storage.TransactionBackend, error)
type FSTransaction ¶
type FSTransaction struct { Uuid uuid.UUID storage.TransactionBackend // contains filtered or unexported fields }
func (*FSTransaction) Commit ¶
func (transaction *FSTransaction) Commit() error
func (*FSTransaction) GetUuid ¶
func (transaction *FSTransaction) GetUuid() uuid.UUID
func (repository *FSRepository) Tidy() { wg := sync.WaitGroup{} concurrency := make(chan bool, runtime.NumCPU()*2+1) cwalk.Walk(repository.PathObjects(), func(path string, f os.FileInfo, err error) error { if err != nil { log.Fatal(err) } object := fmt.Sprintf("%s/%s", repository.PathObjects(), path) if filepath.Clean(object) == filepath.Clean(repository.PathObjects()) { return nil } if !f.IsDir() { concurrency <- true wg.Add(1) go func(object string) { defer func() { <-concurrency }() defer func() { wg.Done() }() if f.Sys().(*syscall.Stat_t).Nlink == 1 { os.Remove(object) } }(object) } return nil }) wg.Wait() cwalk.Walk(repository.PathChunks(), func(path string, f os.FileInfo, err error) error { if err != nil { log.Fatal(err) } chunk := fmt.Sprintf("%s/%s", repository.PathChunks(), path) if filepath.Clean(chunk) == filepath.Clean(repository.PathChunks()) { return nil } if !f.IsDir() { concurrency <- true wg.Add(1) go func(chunk string) { defer func() { <-concurrency }() defer func() { wg.Done() }() if f.Sys().(*syscall.Stat_t).Nlink == 1 { os.Remove(chunk) } }(chunk) } return nil }) wg.Wait() }
func (*FSTransaction) Path ¶
func (transaction *FSTransaction) Path() string
func (*FSTransaction) PutFilesystem ¶
func (transaction *FSTransaction) PutFilesystem(data []byte) error
func (*FSTransaction) PutIndex ¶
func (transaction *FSTransaction) PutIndex(data []byte) error
func (*FSTransaction) PutMetadata ¶
func (transaction *FSTransaction) PutMetadata(data []byte) error
Click to show internal directories.
Click to hide internal directories.