Documentation ¶
Overview ¶
Package shell implements a remote API interface for a running ipfs daemon
Index ¶
- Constants
- type BlockStat
- type BucketStat
- type Buckets
- type Error
- type GetBlockResult
- type IdOutput
- type IntList
- type LfsOpts
- func ForceFlush(enabled bool) LfsOpts
- func NeedAvailTime(enabled bool) LfsOpts
- func SetAddress(addr string) LfsOpts
- func SetDataCount(dataCount int) LfsOpts
- func SetObjectName(objectName string) LfsOpts
- func SetOp(key, value string) LfsOpts
- func SetParityCount(parityCount int) LfsOpts
- func SetPassword(pwd string) LfsOpts
- func SetPolicy(policy int) LfsOpts
- func SetPrefixFilter(prefix string) LfsOpts
- func SetSecretKey(sk string) LfsOpts
- func UseErasureCodeOrMulRep(enabled bool) LfsOpts
- type Logger
- type ObjectStat
- type Objects
- type PeerInfo
- type PeerList
- type PeerState
- type PeersList
- type Request
- type RequestBuilder
- func (r *RequestBuilder) Arguments(args ...string) *RequestBuilder
- func (r *RequestBuilder) Body(body io.Reader) *RequestBuilder
- func (r *RequestBuilder) BodyBytes(body []byte) *RequestBuilder
- func (r *RequestBuilder) BodyString(body string) *RequestBuilder
- func (r *RequestBuilder) Exec(ctx context.Context, res interface{}) error
- func (r *RequestBuilder) Header(name, value string) *RequestBuilder
- func (r *RequestBuilder) Option(key string, value interface{}) *RequestBuilder
- func (r *RequestBuilder) Send(ctx context.Context) (*Response, error)
- type Response
- type Shell
- func (s *Shell) BlockGet(path string) ([]byte, error)
- func (s *Shell) BlockPut(block []byte, format, mhtype string, mhlen int) (string, error)
- func (s *Shell) BlockStat(path string) (string, int, error)
- func (s *Shell) BootstrapAdd(peers []string) ([]string, error)
- func (s *Shell) BootstrapAddDefault() ([]string, error)
- func (s *Shell) BootstrapRmAll() ([]string, error)
- func (s *Shell) CreateBucket(BucketName string, options ...LfsOpts) (*Buckets, error)
- func (s *Shell) CreateUser(options ...LfsOpts) (*UserPrivMessage, error)
- func (s *Shell) DeleteBucket(BucketName string, options ...LfsOpts) (*Buckets, error)
- func (s *Shell) DeleteFrom(key, to string, options ...LfsOpts) (string, error)
- func (s *Shell) DeleteObject(ObjectName, BucketName string, options ...LfsOpts) (*Objects, error)
- func (s *Shell) FindPeer(peer string) (*PeerInfo, error)
- func (s *Shell) Fsync(options ...LfsOpts) error
- func (s *Shell) GetBlockFrom(key, id string, options ...LfsOpts) (string, error)
- func (s *Shell) GetFrom(key, id string, options ...LfsOpts) (*queryEvent, error)
- func (s *Shell) GetLogs(ctx context.Context) (Logger, error)
- func (s *Shell) GetObject(ObjectName, BucketName string, options ...LfsOpts) (io.ReadCloser, error)
- func (s *Shell) GetObjectToFile(ObjectName, BucketName, outPath string, options ...LfsOpts) error
- func (s *Shell) HeadBucket(BucketName string, options ...LfsOpts) (*Buckets, error)
- func (s *Shell) HeadObject(ObjectName, BucketName string, options ...LfsOpts) (*Objects, error)
- func (s *Shell) ID(peer ...string) (*IdOutput, error)
- func (s *Shell) IsUp() bool
- func (s *Shell) ListBuckets(options ...LfsOpts) (*Buckets, error)
- func (s *Shell) ListKeepers(options ...LfsOpts) (*PeerList, error)
- func (s *Shell) ListObjects(BucketName string, options ...LfsOpts) (*Objects, error)
- func (s *Shell) PutObject(r io.Reader, ObjectName, BucketName string, options ...LfsOpts) (*Objects, error)
- func (s *Shell) Request(command string, args ...string) *RequestBuilder
- func (s *Shell) ResolvePath(path string) (string, error)
- func (s *Shell) ResultSummary() int
- func (s *Shell) SetTimeout(d time.Duration)
- func (s *Shell) ShowStorage(options ...LfsOpts) error
- func (s *Shell) StartUser(address string, options ...LfsOpts) error
- func (s *Shell) SwarmConnect(ctx context.Context, addr ...string) error
- func (s *Shell) SwarmPeers(ctx context.Context) (*SwarmConnInfos, error)
- func (s *Shell) TestLocalinfo()
- func (s *Shell) Version() (string, string, error)
- type StringList
- type SwarmConnInfo
- type SwarmConnInfos
- type SwarmStreamInfo
- type UserPrivMessage
Constants ¶
const ( DefaultPathName = ".mefs" DefaultPathRoot = "~/" + DefaultPathName DefaultApiFile = "api" EnvDir = "MEFS_PATH" )
const ( DirectPin = "direct" RecursivePin = "recursive" IndirectPin = "indirect" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BucketStat ¶
type BucketStat struct { BucketName string BucketID int32 Ctime string Policy int32 DataCount int32 ParityCount int32 }
func (BucketStat) String ¶
func (bk BucketStat) String() string
type Buckets ¶
type Buckets struct { Method string Buckets []BucketStat }
type GetBlockResult ¶
type GetBlockResult struct {
IsExist bool
}
type LfsOpts ¶
type LfsOpts = func(*RequestBuilder) error
func ForceFlush ¶
func NeedAvailTime ¶
func SetAddress ¶
func SetDataCount ¶
func SetObjectName ¶
func SetParityCount ¶
func SetPassword ¶
func SetPrefixFilter ¶
func SetSecretKey ¶
func UseErasureCodeOrMulRep ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is used to handle incoming logs from the ipfs node
type ObjectStat ¶
type ObjectStat struct { ObjectName string ObjectSize int32 MD5 string Ctime string Dir bool LatestChalTime string }
func (ObjectStat) String ¶
func (ob ObjectStat) String() string
type Objects ¶
type Objects struct { Method string Objects []ObjectStat }
type Request ¶
type Request struct { Ctx context.Context ApiBase string Command string Args []string Opts map[string]string Body io.Reader Headers map[string]string }
func NewRequest ¶
type RequestBuilder ¶
type RequestBuilder struct {
// contains filtered or unexported fields
}
RequestBuilder is an IPFS commands request builder.
func (*RequestBuilder) Arguments ¶
func (r *RequestBuilder) Arguments(args ...string) *RequestBuilder
Arguments adds the arguments to the args.
func (*RequestBuilder) Body ¶
func (r *RequestBuilder) Body(body io.Reader) *RequestBuilder
Body sets the request body to the given reader.
func (*RequestBuilder) BodyBytes ¶
func (r *RequestBuilder) BodyBytes(body []byte) *RequestBuilder
BodyBytes sets the request body to the given buffer.
func (*RequestBuilder) BodyString ¶
func (r *RequestBuilder) BodyString(body string) *RequestBuilder
BodyString sets the request body to the given string.
func (*RequestBuilder) Exec ¶
func (r *RequestBuilder) Exec(ctx context.Context, res interface{}) error
Exec sends the request a request and decodes the response.
func (*RequestBuilder) Header ¶
func (r *RequestBuilder) Header(name, value string) *RequestBuilder
Header sets the given header.
func (*RequestBuilder) Option ¶
func (r *RequestBuilder) Option(key string, value interface{}) *RequestBuilder
Option sets the given option.
type Response ¶
type Response struct { Output io.ReadCloser Error *Error }
type Shell ¶
type Shell struct {
// contains filtered or unexported fields
}
func NewLocalShell ¶
func NewLocalShell() *Shell
func (*Shell) BootstrapAddDefault ¶
func (*Shell) BootstrapRmAll ¶
func (*Shell) CreateBucket ¶
func (*Shell) CreateUser ¶
func (s *Shell) CreateUser(options ...LfsOpts) (*UserPrivMessage, error)
func (*Shell) DeleteBucket ¶
func (*Shell) DeleteFrom ¶
func (*Shell) DeleteObject ¶
func (*Shell) GetBlockFrom ¶
func (*Shell) GetObjectToFile ¶
func (*Shell) HeadBucket ¶
func (*Shell) HeadObject ¶
func (*Shell) ID ¶
ID gets information about a given peer. Arguments:
peer: peer.ID of the node to look up. If no peer is specified,
return information about the local peer.
func (*Shell) ListObjects ¶
func (*Shell) ResultSummary ¶
ResultSummary keeper计算时空值命令,用于测试,返回计算好的时空值
func (*Shell) SetTimeout ¶
func (*Shell) ShowStorage ¶
func (*Shell) SwarmConnect ¶
SwarmConnect opens a swarm connection to a specific address.
func (*Shell) SwarmPeers ¶
func (s *Shell) SwarmPeers(ctx context.Context) (*SwarmConnInfos, error)
SwarmPeers gets all the swarm peers
type StringList ¶
type StringList struct {
ChildLists []string
}
func (StringList) String ¶
func (fl StringList) String() string
type SwarmConnInfo ¶
type SwarmConnInfo struct { Addr string Peer string Latency string Muxer string Streams []SwarmStreamInfo }
type SwarmConnInfos ¶
type SwarmConnInfos struct {
Peers []SwarmConnInfo
}
type SwarmStreamInfo ¶
type SwarmStreamInfo struct {
Protocol string
}