storagemanager

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2016 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

package storagemanager implements a storage manager for the host on Sia. The storage manager can add sectors, remove sectors, and manage how sectors are distributed between a number of storage folders.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StorageManager

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

StorageManager tracks multiple storage folders, and is responsible for adding sectors, removing sectors, and overall managing the way that data is stored.

func New

func New(persistDir string) (*StorageManager, error)

New returns an initialized StorageManager.

func (*StorageManager) AddSector

func (sm *StorageManager) AddSector(sectorRoot crypto.Hash, expiryHeight types.BlockHeight, sectorData []byte) error

AddSector will add a data sector to the host, correctly selecting the storage folder in which the sector belongs.

func (*StorageManager) AddStorageFolder

func (sm *StorageManager) AddStorageFolder(path string, size uint64) error

AddStorageFolder adds a storage folder to the host.

func (*StorageManager) Close

func (sm *StorageManager) Close() (composedError error)

Close will shut down the storage manager.

func (*StorageManager) DeleteSector

func (sm *StorageManager) DeleteSector(sectorRoot crypto.Hash) error

DeleteSector deletes a sector from the host explicitly, meaning that the host will be unable to transfer that sector to a renter, and that the host will be unable to perform a storage proof on that sector. This function is not intended to be used, however is available so that hosts can easily comply if compelled by their government to delete certain data.

func (*StorageManager) ReadSector

func (sm *StorageManager) ReadSector(sectorRoot crypto.Hash) (sectorBytes []byte, err error)

ReadSector will pull a sector from disk into memory.

func (*StorageManager) RemoveSector

func (sm *StorageManager) RemoveSector(sectorRoot crypto.Hash, expiryHeight types.BlockHeight) error

RemoveSector will remove a sector from the host at the given expiry height. If the provided sector does not have an expiration at the given height, an error will be thrown.

func (*StorageManager) RemoveStorageFolder

func (sm *StorageManager) RemoveStorageFolder(removalIndex int, force bool) error

RemoveStorageFolder removes a storage folder from the host.

func (*StorageManager) ResetStorageFolderHealth

func (sm *StorageManager) ResetStorageFolderHealth(index int) error

ResetStorageFolderHealth will reset the read and write statistics for the storage folder.

func (*StorageManager) ResizeStorageFolder

func (sm *StorageManager) ResizeStorageFolder(storageFolderIndex int, newSize uint64) error

ResizeStorageFolder changes the amount of disk space that is going to be allocated to a storage folder.

func (*StorageManager) StorageFolders

func (sm *StorageManager) StorageFolders() (sfms []modules.StorageFolderMetadata)

StorageFolders provides information about all of the storage folders in the host.

Jump to

Keyboard shortcuts

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