Documentation ¶
Index ¶
Constants ¶
const ( Version = "1.0" WorkerChanSize = 8 // Max no of goroutines when walking the file tree )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is the main object which implements all things pinning.
func NewAPI ¶
func NewAPI(lstore *localstore.DB, stateStore state.Store, params *storage.FileStoreParams, tags *chunk.Tags, api *api.API) *API
NewAPI creates a API object that is required for pinning and unpinning
func (*API) PinFiles ¶
PinFiles is used to pin a RAW file or a collection (which hash manifest's) to the local Swarm node. It takes the root hash as the argument and walks down the merkle tree and pin all the chunks that are encountered on the way. It pins both data chunk and tree chunks. The pre-requisite is that the file should be present in the local database. This function is called from two places 1) Just after the file is uploaded 2) anytime after uploading the file using the pin command. This function can pin both encrypted and non-encrypted files.
func (*API) UnpinFiles ¶
UnPinFiles is used to unpin an already pinned file. It takes the root hash of the file and walks down the merkle tree unpinning all the chunks that are encountered on the way. The pre-requisite is that the file should have been already pinned using the PinFiles function. This function can be called only from an external command.
type PinInfo ¶
PinInfo is the struct that stores the information about pinned files This is stored in the state DB with Address as key
func (*PinInfo) MarshalBinary ¶
MarshalBinary encodes the PinInfo object in to a binary form for storage
func (*PinInfo) UnmarshalBinary ¶
UnmarshalBinary decodes the binary form from the state store to the PinInfo object