Documentation ¶
Index ¶
- Constants
- Variables
- func RegularSlashes(path string) (res string)
- type Api
- func (self *Api) AddFile(mhash, path, fname string, content []byte, nameresolver bool) (storage.Key, string, error)
- func (self *Api) AppendFile(mhash, path, fname string, existingSize int64, content []byte, ...) (storage.Key, string, error)
- func (self *Api) BuildDirectoryTree(mhash string, nameresolver bool) (key storage.Key, manifestEntryMap map[string]*manifestTrieEntry, err error)
- func (self *Api) Get(key storage.Key, path string) (reader storage.LazySectionReader, mimeType string, status int, err error)
- func (self *Api) Modify(key storage.Key, path, contentHash, contentType string) (storage.Key, error)
- func (a *Api) NewManifest() (storage.Key, error)
- func (a *Api) NewManifestWalker(key storage.Key, quitC chan bool) (*ManifestWalker, error)
- func (a *Api) NewManifestWriter(key storage.Key, quitC chan bool) (*ManifestWriter, error)
- func (self *Api) Put(content, contentType string) (storage.Key, error)
- func (self *Api) RemoveFile(mhash, path, fname string, nameresolver bool) (string, error)
- func (self *Api) Resolve(uri *URI) (storage.Key, error)
- func (self *Api) Retrieve(key storage.Key) storage.LazySectionReader
- func (self *Api) Store(data io.Reader, size int64, wg *sync.WaitGroup) (key storage.Key, err error)
- func (self *Api) Upload(uploadDir, index string) (hash string, err error)
- type Config
- type Control
- type ErrResolve
- type FileSystem
- type Manifest
- type ManifestEntry
- type ManifestList
- type ManifestWalker
- type ManifestWriter
- type Resolver
- type Response
- type Storage
- type URI
- type WalkFn
Constants ¶
const (
ManifestType = "application/bzz-manifest+json"
)
Variables ¶
var SkipManifest = errors.New("skip this manifest")
SkipManifest is used as a return value from WalkFn to indicate that the manifest should be skipped
Functions ¶
func RegularSlashes ¶
file system manifest always contains regularized paths no leading or trailing slashes, only single slashes inside
Types ¶
type Api ¶ added in v1.5.0
type Api struct {
// contains filtered or unexported fields
}
Api implements webserver/file system related content storage and retrieval on top of the dpa it is the public interface of the dpa which is included in the ethereum stack
func (*Api) AppendFile ¶ added in v1.6.0
func (*Api) BuildDirectoryTree ¶ added in v1.6.0
func (*Api) Get ¶ added in v1.5.0
func (self *Api) Get(key storage.Key, path string) (reader storage.LazySectionReader, mimeType string, status int, err error)
Get uses iterative manifest retrieval and prefix matching to resolve basePath to content using dpa retrieve it returns a section reader, mimeType, status and an error
func (*Api) NewManifest ¶ added in v1.6.0
NewManifest creates and stores a new, empty manifest
func (*Api) NewManifestWalker ¶ added in v1.6.0
func (*Api) NewManifestWriter ¶ added in v1.6.0
func (*Api) RemoveFile ¶ added in v1.6.0
func (*Api) Retrieve ¶ added in v1.5.0
func (self *Api) Retrieve(key storage.Key) storage.LazySectionReader
DPA reader API
type Config ¶
type Config struct { // serialised/persisted fields *storage.StoreParams *storage.ChunkerParams *network.HiveParams Swap *swap.SwapParams *network.SyncParams Path string Port string PublicKey string BzzKey string EnsRoot common.Address NetworkId uint64 }
separate bzz directories allow several bzz nodes running in parallel
type Control ¶
type Control struct {
// contains filtered or unexported fields
}
func (*Control) BlockNetworkRead ¶ added in v1.5.0
func (*Control) SwapEnabled ¶ added in v1.5.0
func (*Control) SyncEnabled ¶ added in v1.5.0
type ErrResolve ¶
type ErrResolve error
type FileSystem ¶
type FileSystem struct {
// contains filtered or unexported fields
}
func NewFileSystem ¶
func NewFileSystem(api *Api) *FileSystem
func (*FileSystem) Download ¶
func (self *FileSystem) Download(bzzpath, localpath string) error
Download replicates the manifest basePath structure on the local filesystem under localpath
DEPRECATED: Use the HTTP API instead
type Manifest ¶
type Manifest struct {
Entries []ManifestEntry `json:"entries,omitempty"`
}
Manifest represents a swarm manifest
type ManifestEntry ¶
type ManifestEntry struct { Hash string `json:"hash,omitempty"` Path string `json:"path,omitempty"` ContentType string `json:"contentType,omitempty"` Mode int64 `json:"mode,omitempty"` Size int64 `json:"size,omitempty"` ModTime time.Time `json:"mod_time,omitempty"` Status int `json:"status,omitempty"` }
ManifestEntry represents an entry in a swarm manifest
type ManifestList ¶
type ManifestList struct { CommonPrefixes []string `json:"common_prefixes,omitempty"` Entries []*ManifestEntry `json:"entries,omitempty"` }
ManifestList represents the result of listing files in a manifest
type ManifestWalker ¶
type ManifestWalker struct {
// contains filtered or unexported fields
}
ManifestWalker is used to recursively walk the entries in the manifest and all of its submanifests
func (*ManifestWalker) Walk ¶
func (m *ManifestWalker) Walk(walkFn WalkFn) error
Walk recursively walks the manifest calling walkFn for each entry in the manifest, including submanifests
type ManifestWriter ¶
type ManifestWriter struct {
// contains filtered or unexported fields
}
ManifestWriter is used to add and remove entries from an underlying manifest
func (*ManifestWriter) AddEntry ¶
func (m *ManifestWriter) AddEntry(data io.Reader, e *ManifestEntry) (storage.Key, error)
AddEntry stores the given data and adds the resulting key to the manifest
func (*ManifestWriter) RemoveEntry ¶
func (m *ManifestWriter) RemoveEntry(path string) error
RemoveEntry removes the given path from the manifest
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
implements a service
DEPRECATED: Use the HTTP API instead
func NewStorage ¶
func (*Storage) Get ¶
Get retrieves the content from bzzpath and reads the response in full It returns the Response object, which serialises containing the response body as the value of the Content field NOTE: if error is non-nil, sResponse may still have partial content the actual size of which is given in len(resp.Content), while the expected size is resp.Size
DEPRECATED: Use the HTTP API instead
func (*Storage) Modify ¶
func (self *Storage) Modify(rootHash, path, contentHash, contentType string) (newRootHash string, err error)
Modify(rootHash, basePath, contentHash, contentType) takes th e manifest trie rooted in rootHash, and merge on to it. creating an entry w conentType (mime)
DEPRECATED: Use the HTTP API instead
type URI ¶
type URI struct { // Scheme has one of the following values: // // * bzz - an entry in a swarm manifest // * bzzr - raw swarm content // * bzzi - immutable URI of an entry in a swarm manifest // (address is not resolved) Scheme string // Addr is either a hexadecimal storage key or it an address which // resolves to a storage key Addr string // Path is the path to the content within a swarm manifest Path string }
URI is a reference to content stored in swarm.
type WalkFn ¶
type WalkFn func(entry *ManifestEntry) error
WalkFn is the type of function called for each entry visited by a recursive manifest walk