api

package
v0.0.0-...-136a18e Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultHTTPListenAddr = "127.0.0.1"
	DefaultHTTPPort       = "8500"
)
View Source
const (
	ManifestType = "application/bzz-manifest+json"
)

Variables

View Source
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

func RegularSlashes(path string) (res string)

file system manifest always contains regularized paths no leading or trailing slashes, only single slashes inside

Types

type Config

type Config struct {
	// serialised/persisted fields
	*storage.StoreParams
	*storage.ChunkerParams
	*network.HiveParams
	Swap *swap.SwapParams
	*network.SyncParams
	Contract    common.Address
	EnsRoot     common.Address
	EnsAPIs     []string
	Path        string
	ListenAddr  string
	Port        string
	PublicKey   string
	BzzKey      string
	NetworkId   uint64
	SwapEnabled bool
	SyncEnabled bool
	SwapApi     string
	Cors        string
	BzzAccount  string
	BootNodes   string
}

separate bzz directories allow several bzz nodes running in parallel

func NewDefaultConfig

func NewDefaultConfig() (self *Config)

create a default config with all parameters to set to defaults

func (*Config) Init

func (self *Config) Init(prvKey *ecdsa.PrivateKey)

some config params need to be initialized after the complete config building phase is completed (e.g. due to overriding flags)

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

func (*ManifestWriter) Store

func (m *ManifestWriter) Store() (storage.Key, error)

Store stores the manifest, returning the resulting storage key

type WalkFn

type WalkFn func(entry *ManifestEntry) error

WalkFn is the type of function called for each entry visited by a recursive manifest walk

Jump to

Keyboard shortcuts

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