Documentation ¶
Overview ¶
Package api holds declarations for types used in rep-mgr APIs to make them re-usable across differen tools. This include RPC API "Serial[izable]" versions for types. The Go API uses natives types, while RPC API, REST APIs etc use serializable types (i.e. json format). Conversion methods exists between types.
Note that all conversion methods ignore any parsing errors. All values must be validated first before initializing any of the types defined here.
Index ¶
- Constants
- Variables
- func ParseAllocate(allocateID string) (rmId peer.ID, knodeId peer.ID, err error)
- func ParseRmPeersFromAllocator(strs []peer.ID) ([]peer.ID, error)
- func PeersToStrings(peers []peer.ID) []string
- func StringsToPeers(strs []string) []peer.ID
- type AddParams
- type AddedOutput
- type Alert
- type Cid
- type ConnectGraph
- type Error
- type GetKnodeListArgs
- type GlobalPinInfo
- type GlobalRepoGC
- type ID
- type IPFSAddParams
- type IPFSID
- type IPFSPinInfo
- type IPFSPinStatus
- type IPFSRepoGC
- type IPFSRepoStat
- type KNodeAddrs
- type KnodeMetric
- type Metric
- type MetricSlice
- type MetricsSet
- type Multiaddr
- type Node
- type NodeWithMeta
- type Pin
- func (pin Pin) Defined() bool
- func (pin Pin) Equals(pin2 Pin) bool
- func (pin Pin) ExpiredAt(t time.Time) bool
- func (pin Pin) FilterAllocators(peerID peer.ID) []string
- func (pin Pin) IsPinEverywhere() bool
- func (pin Pin) IsRemotePin(pid peer.ID) bool
- func (pin Pin) ProtoMarshal() ([]byte, error)
- func (pin *Pin) ProtoUnmarshal(data []byte) error
- func (pin Pin) String() string
- type PinDepth
- type PinDetail
- type PinInfo
- type PinInfoShort
- type PinMode
- type PinOptions
- type PinPath
- type PinResp
- type PinType
- type RepoGC
- type TrackerStatus
- type Version
Constants ¶
const ( TrackerStatusError = TrackerStatusClusterError | TrackerStatusPinError | TrackerStatusUnpinError TrackerStatusQueued = TrackerStatusPinQueued | TrackerStatusUnpinQueued )
Composite TrackerStatus.
Variables ¶
var CidUndef = Cid{cid.Undef}
CidUndef is an Undefined CID.
var DefaultShardSize = uint64(100 * 1024 * 1024) // 100 MB
DefaultShardSize is the shard size for params objects created with DefaultParams().
Functions ¶
func ParseAllocate ¶
func PeersToStrings ¶
PeersToStrings Encodes a list of peers.
func StringsToPeers ¶
StringsToPeers decodes peer.IDs from strings.
Types ¶
type AddParams ¶
type AddParams struct { PinOptions Local bool Recursive bool Hidden bool Wrap bool Shard bool StreamChannels bool Format string // selects with adder NoPin bool IPFSAddParams }
AddParams contains all of the configurable parameters needed to specify the importing process of a file being added to an rep-mgr
func AddParamsFromQuery ¶
AddParamsFromQuery parses the AddParams object from a URL.Query().
func DefaultAddParams ¶
func DefaultAddParams() AddParams
DefaultAddParams returns a AddParams object with standard defaults
func (AddParams) ToQueryString ¶
ToQueryString returns a url query string (key=value&key2=value2&...)
type AddedOutput ¶
type AddedOutput struct { Name string `json:"name" codec:"n,omitempty"` Cid Cid `json:"cid" codec:"c"` Bytes uint64 `json:"bytes,omitempty" codec:"b,omitempty"` Size uint64 `json:"size,omitempty" codec:"s,omitempty"` Allocations []peer.ID `json:"allocations,omitempty" codec:"a,omitempty"` }
AddedOutput carries information for displaying the standard ipfs output indicating a node of a file has been added.
type Cid ¶
Cid embeds a cid.Cid with the MarshalJSON/UnmarshalJSON methods overwritten.
func (Cid) MarshalJSON ¶
MarshalJSON marshals a CID as JSON as a normal CID string.
func (*Cid) UnmarshalJSON ¶
UnmarshalJSON reads a CID from its representation as JSON string.
type ConnectGraph ¶
type ConnectGraph struct { ClusterID peer.ID `json:"cluster_id" codec:"id"` IDtoPeername map[string]string `json:"id_to_peername" codec:"ip,omitempty"` // ipfs to ipfs links IPFSLinks map[string][]peer.ID `json:"ipfs_links" codec:"il,omitempty"` // cluster to cluster links ClusterLinks map[string][]peer.ID `json:"cluster_links" codec:"cl,omitempty"` // cluster trust links ClusterTrustLinks map[string]bool `json:"cluster_trust_links" codec:"ctl,omitempty"` // cluster to ipfs links ClustertoIPFS map[string]peer.ID `json:"cluster_to_ipfs" codec:"ci,omitempty"` }
ConnectGraph holds information about the connectivity of the cluster To read, traverse the keys of ClusterLinks. Each such id is one of the peers of the "ClusterID" peer running the query. ClusterLinks[id] in turn lists the ids that peer "id" sees itself connected to. It is possible that id is a peer of ClusterID, but ClusterID can not reach id over rpc, in which case ClusterLinks[id] == [], as id's view of its connectivity can not be retrieved.
Iff there was an error reading the IPFSID of the peer then id will not be a key of ClustertoIPFS or IPFSLinks. Finally iff id is a key of ClustertoIPFS then id will be a key of IPFSLinks. In the event of a SwarmPeers error IPFSLinks[id] == [].
type Error ¶
type Error struct { Code int `json:"code" codec:"o,omitempty"` Message string `json:"message" codec:"m,omitempty"` }
Error can be used by APIs to return errors.
type GetKnodeListArgs ¶
type GetKnodeListArgs struct {
// contains filtered or unexported fields
}
type GlobalPinInfo ¶
type GlobalPinInfo struct { Cid Cid `json:"cid" codec:"c"` Name string `json:"name" codec:"n"` Allocations []string `json:"allocations" codec:"a,omitempty"` Origins []Multiaddr `json:"origins" codec:"g,omitempty"` Created time.Time `json:"created" codec:"t,omitempty"` Metadata map[string]string `json:"metadata" codec:"m,omitempty"` // https://github.com/golang/go/issues/28827 // Peer IDs are of string Kind(). We can't use peer IDs here // as Go ignores TextMarshaler. PeerMap map[string][]PinInfoShort `json:"peer_map" codec:"pm,omitempty"` }
GlobalPinInfo contains cluster-wide status information about a tracked Cid, indexed by cluster peer.
func (*GlobalPinInfo) Add ¶
func (gpi *GlobalPinInfo) Add(pi PinInfo)
Add adds a PinInfo object to a GlobalPinInfo
func (*GlobalPinInfo) Defined ¶
func (gpi *GlobalPinInfo) Defined() bool
Defined returns if the object is not empty.
func (GlobalPinInfo) Match ¶
func (gpi GlobalPinInfo) Match(filter TrackerStatus) bool
Match returns true if one of the statuses in GlobalPinInfo matches the given filter.
func (GlobalPinInfo) String ¶
func (gpi GlobalPinInfo) String() string
String returns the string representation of a GlobalPinInfo.
type GlobalRepoGC ¶
GlobalRepoGC contains cluster-wide information about garbage collected CIDs from IPFS.
type ID ¶
type ID struct { ID peer.ID `json:"id" codec:"i,omitempty"` Addresses []Multiaddr `json:"addresses" codec:"a,omitempty"` ClusterPeers []peer.ID `json:"cluster_peers" codec:"cp,omitempty"` ClusterPeersAddresses []Multiaddr `json:"cluster_peers_addresses" codec:"cpa,omitempty"` Version string `json:"version" codec:"v,omitempty"` Commit string `json:"commit" codec:"c,omitempty"` RPCProtocolVersion protocol.ID `json:"rpc_protocol_version" codec:"rv,omitempty"` Error string `json:"error" codec:"e,omitempty"` IPFS IPFSID `json:"ipfs,omitempty" codec:"ip,omitempty"` Peername string `json:"peername" codec:"pn,omitempty"` }
ID holds information about the Cluster peer
type IPFSAddParams ¶
type IPFSAddParams struct { Layout string Chunker string RawLeaves bool Progress bool CidVersion int HashFun string NoCopy bool }
IPFSAddParams groups options specific to the ipfs-adder, which builds UnixFS dags with the input files. This struct is embedded in AddParams.
type IPFSID ¶
type IPFSID struct { ID peer.ID `json:"id,omitempty" codec:"i,omitempty"` Addresses []Multiaddr `json:"addresses" codec:"a,omitempty"` Error string `json:"error" codec:"e,omitempty"` }
IPFSID is used to store information about the underlying IPFS daemon
type IPFSPinInfo ¶
type IPFSPinInfo struct { PeerId peer.ID `json:"PeerId" codec:"peerId"` Cid Cid `json:"Cid" codec:"c"` Type IPFSPinStatus `json:"Type" codec:"t"` Error string `json:"Error" codec:"e"` }
IPFSPinInfo represents an IPFS Pin, which only has a CID and type. Its JSON form is what IPFS returns when querying a pinset.
func (IPFSPinInfo) IsPinned ¶
func (ipi IPFSPinInfo) IsPinned() bool
type IPFSPinStatus ¶
type IPFSPinStatus int
IPFSPinStatus represents the status of a pin in IPFS (direct, recursive etc.)
const ( IPFSPinStatusBug IPFSPinStatus = iota IPFSPinStatusError IPFSPinStatusDirect IPFSPinStatusRecursive IPFSPinStatusIndirect IPFSPinStatusUnpinned )
IPFSPinStatus values FIXME include maxdepth
func IPFSPinStatusFromString ¶
func IPFSPinStatusFromString(t string) IPFSPinStatus
IPFSPinStatusFromString parses a string and returns the matching IPFSPinStatus.
func (IPFSPinStatus) IsPinned ¶
func (ips IPFSPinStatus) IsPinned(maxDepth PinDepth) bool
IsPinned returns true if the item is pinned as expected by the maxDepth parameter.
func (IPFSPinStatus) MarshalJSON ¶
func (ips IPFSPinStatus) MarshalJSON() ([]byte, error)
MarshalJSON converts a status to JSON.
func (IPFSPinStatus) String ¶
func (ips IPFSPinStatus) String() string
String returns the string form of the status as written by IPFS.
func (IPFSPinStatus) ToTrackerStatus ¶
func (ips IPFSPinStatus) ToTrackerStatus() TrackerStatus
ToTrackerStatus converts the IPFSPinStatus value to the appropriate TrackerStatus value.
func (*IPFSPinStatus) UnmarshalJSON ¶
func (ips *IPFSPinStatus) UnmarshalJSON(b []byte) error
UnmarshalJSON parses a status from JSON
type IPFSRepoGC ¶
type IPFSRepoGC struct { Key Cid `json:"key,omitempty" codec:"k,omitempty"` Error string `json:"error,omitempty" codec:"e,omitempty"` }
IPFSRepoGC represents the streaming response sent from repo gc API of IPFS.
type IPFSRepoStat ¶
type IPFSRepoStat struct { RepoSize uint64 `codec:"r,omitempty"` StorageMax uint64 `codec:"s, omitempty"` }
IPFSRepoStat wraps information about the IPFS repository.
type KnodeMetric ¶
type KnodeMetric struct { Name string `json:"name" codec:"n,omitempty"` PeerID peer.ID `json:"peer_id,omitempty"` //knode节点id Value int64 `json:"value,omitempty"` //knode可用空间 Expire time.Time `json:"expire,omitempty"` //本条信息过期时间 Valid bool `json:"valid,omitempty"` //是否可用,既该节点是否可分配 Weight int64 `json:"weight,omitempty"` //权重 ReceivedAt int64 `json:"received_at,omitempty"` //时间 Address string `json:"address,omitempty"` //该knode的地址,两个用处:用于分配给web上传(打洞后的外网访问地址和端口);用于解析该knode的地理位置 Netspeed int `json:"netspeed,omitempty"` //网络速度,用于判断节点的网络环境 Location string `json:"location,omitempty"` //位置 NetworkOperator string `json:"network_operator,omitempty"` //电信网络运营商 PinAddCount int64 `json:"pin_add_count,omitempty"` // 当前正在pin add 的数量 }
func (*KnodeMetric) String ¶
func (m *KnodeMetric) String() string
func (*KnodeMetric) ToMetric ¶
func (m *KnodeMetric) ToMetric(rm Metric) Metric
type Metric ¶
type Metric struct { Name string `json:"name" codec:"n,omitempty"` Peer peer.ID `json:"peer" codec:"p,omitempty"` Value string `json:"value" codec:"v,omitempty"` Expire int64 `json:"expire" codec:"e,omitempty"` Valid bool `json:"valid" codec:"d,omitempty"` Weight int64 `json:"weight" codec:"w,omitempty"` Partitionable bool `json:"partitionable" codec:"o,omitempty"` ReceivedAt int64 `json:"received_at" codec:"t,omitempty"` // ReceivedAt contains a UnixNano timestamp //add by lyc Group string // `json:"group" codec:"t,omitempty"` //该RM节点所属分组 Tag string // `json:"tag" codec:"t,omitempty"` //标签,与分组一样,用于节点分配 KnodeList []KnodeMetric //`json:"knodeList" codec:"t,omitempty"` // 该RM管理下的knode列表) }
Metric transports information about a peer.ID. It is used to decide pin allocations by a PinAllocator. IPFS cluster is agnostic to the Value, which should be interpreted by the PinAllocator. The ReceivedAt value is a timestamp representing when a peer has received the metric value.
type MetricSlice ¶
type MetricSlice []Metric
MetricSlice is a sortable Metric array.
func (MetricSlice) Len ¶
func (es MetricSlice) Len() int
func (MetricSlice) Less ¶
func (es MetricSlice) Less(i, j int) bool
func (MetricSlice) Swap ¶
func (es MetricSlice) Swap(i, j int)
type MetricsSet ¶
MetricsSet is a map to carry slices of metrics indexed by type.
type Multiaddr ¶
Multiaddr is a concrete type to wrap a Multiaddress so that it knows how to serialize and deserialize itself.
func NewMultiaddr ¶
NewMultiaddr returns a cluster Multiaddr wrapper creating the multiaddr.Multiaddr with the given string.
func NewMultiaddrWithValue ¶
NewMultiaddrWithValue returns a new cluster Multiaddr wrapper using the given multiaddr.Multiaddr.
func (Multiaddr) MarshalBinary ¶
MarshalBinary returs the bytes of the wrapped multiaddress.
func (Multiaddr) MarshalJSON ¶
MarshalJSON returns a JSON-formatted multiaddress.
func (*Multiaddr) UnmarshalBinary ¶
UnmarshalBinary casts some bytes as a multiaddress wraps it with the given cluster Multiaddr.
func (*Multiaddr) UnmarshalJSON ¶
UnmarshalJSON parses a cluster Multiaddr from the JSON representation.
type NodeWithMeta ¶
type NodeWithMeta struct { Data []byte `codec:"d,omitempty"` Cid Cid `codec:"c,omitempty"` CumSize uint64 `codec:"s,omitempty"` // Cumulative size }
NodeWithMeta specifies a block of data and a set of optional metadata fields carrying information about the encoded ipld node
func (*NodeWithMeta) Size ¶
func (n *NodeWithMeta) Size() uint64
Size returns how big is the block. It is different from CumSize, which records the size of the underlying tree.
type Pin ¶
type Pin struct { PinOptions Cid Cid `json:"cid" codec:"c"` // See PinType comments Type PinType `json:"type" codec:"t,omitempty"` // The peers to which this pin is allocated Allocations []string `json:"allocations" codec:"a,omitempty"` // MaxDepth associated to this pin. -1 means // recursive. MaxDepth PinDepth `json:"max_depth" codec:"d,omitempty"` // We carry a reference CID to this pin. For // ClusterDAGs, it is the MetaPin CID. For the // MetaPin it is the ClusterDAG CID. For Shards, // it is the previous shard CID. // When not needed the pointer is nil Reference *Cid `json:"reference" codec:"r,omitempty"` // The time that the pin was submitted to the consensus layer. Timestamp time.Time `json:"timestamp" codec:"i,omitempty"` }
Pin carries all the information associated to a CID that is pinned in IPFS Cluster. It also carries transient information (that may not get protobuffed, like UserAllocations).
func PinCid ¶
PinCid is a shortcut to create a Pin only with a Cid. Default is for pin to be recursive and the pin to be of DataType.
func PinWithOpts ¶
func PinWithOpts(c Cid, opts PinOptions) Pin
PinWithOpts creates a new Pin calling PinCid(c) and then sets its PinOptions fields with the given options. Pin fields that are linked to options are set accordingly (MaxDepth from Mode).
func (Pin) Equals ¶
Equals checks if two pins are the same (with the same allocations). If allocations are the same but in different order, they are still considered equivalent.
func (Pin) FilterAllocators ¶
FilterAllocators 根据peerID过滤allocators节点
func (Pin) IsPinEverywhere ¶
IsPinEverywhere returns when the both replication factors are set to -1.
func (Pin) IsRemotePin ¶
IsRemotePin determines whether a Pin's ReplicationFactor has been met, so as to either pin or unpin it from the peer.
func (Pin) ProtoMarshal ¶
ProtoMarshal marshals this Pin using probobuf.
func (*Pin) ProtoUnmarshal ¶
ProtoUnmarshal unmarshals this fields from protobuf-encoded bytes.
type PinDepth ¶
type PinDepth int
PinDepth indicates how deep a pin should be pinned, with -1 meaning "to the bottom", or "recursive".
type PinDetail ¶
type PinDetail struct { LK sync.Mutex IPFSPinStatus IPFSPinStatus `json:",omitempty"` //各节点的pin状态 PinMap map[peer.ID]IPFSPinInfo `json:"pin_map" codec:"pin_map"` }
type PinInfo ¶
type PinInfo struct { Cid Cid `json:"cid" codec:"c"` Name string `json:"name" codec:"m,omitempty"` Peer peer.ID `json:"peer" codec:"p,omitempty"` //Allocations []peer.ID `json:"allocations" codec:"o,omitempty"` Allocations []string `json:"allocations" codec:"o,omitempty"` Origins []Multiaddr `json:"origins" codec:"g,omitempty"` Created time.Time `json:"created" codec:"t,omitempty"` Metadata map[string]string `json:"metadata" codec:"md,omitempty"` Status TrackerStatus `json:"status" codec:"st,omitempty"` TS time.Time `json:"timestamp" codec:"ts,omitempty"` Error string `json:"error" codec:"e,omitempty"` AttemptCount int `json:"attempt_count" codec:"a,omitempty"` PriorityPin bool `json:"priority_pin" codec:"y,omitempty"` Pins []PinInfoShort }
PinInfo holds information about local pins. This is used by the Pin Trackers.
func (PinInfo) ToGlobal ¶
func (pi PinInfo) ToGlobal() GlobalPinInfo
ToGlobal converts a PinInfo object to a GlobalPinInfo with a single peer corresponding to the given PinInfo.
type PinInfoShort ¶
type PinInfoShort struct { PeerName string `json:"peername" codec:"pn,omitempty"` PeerID peer.ID `json:"rm_peer_id,omitempty" codec:"i,omitempty"` IPFS peer.ID `json:"ipfs_peer_id,omitempty" codec:"i,omitempty"` IPFSAddresses []Multiaddr `json:"ipfs_peer_addresses,omitempty" codec:"ia,omitempty"` Status TrackerStatus `json:"status" codec:"st,omitempty"` TS time.Time `json:"timestamp" codec:"ts,omitempty"` Error string `json:"error" codec:"e,omitempty"` //IPFSPinInfo AttemptCount int `json:"attempt_count" codec:"a,omitempty"` PriorityPin bool `json:"priority_pin" codec:"y,omitempty"` }
PinInfoShort is a subset of PinInfo which is embedded in GlobalPinInfo objects and does not carry redundant information as PinInfo would.
func (PinInfoShort) IsPined ¶
func (pis PinInfoShort) IsPined() bool
func (PinInfoShort) IsUnPined ¶
func (pis PinInfoShort) IsUnPined() bool
func (PinInfoShort) String ¶
func (pis PinInfoShort) String() string
String provides a string representation of PinInfoShort.
type PinMode ¶
type PinMode int
PinMode is a PinOption that indicates how to pin something on IPFS, recursively or direct.
func PinModeFromString ¶
PinModeFromString converts a string to PinMode.
func (PinMode) MarshalJSON ¶
MarshalJSON converts the PinMode into a readable string in JSON.
func (PinMode) ToIPFSPinStatus ¶
func (pm PinMode) ToIPFSPinStatus() IPFSPinStatus
ToIPFSPinStatus converts a PinMode to IPFSPinStatus.
func (PinMode) ToPinDepth ¶
ToPinDepth converts the Mode to Depth.
func (*PinMode) UnmarshalJSON ¶
UnmarshalJSON takes a JSON value and parses it into PinMode.
type PinOptions ¶
type PinOptions struct { ReplicationFactorMin int `json:"replication_factor_min" codec:"rn,omitempty"` ReplicationFactorMax int `json:"replication_factor_max" codec:"rx,omitempty"` Name string `json:"name" codec:"n,omitempty"` Mode PinMode `json:"mode" codec:"o,omitempty"` ShardSize uint64 `json:"shard_size" codec:"s,omitempty"` UserAllocations []string `json:"user_allocations" codec:"ua,omitempty"` ExpireAt time.Time `json:"expire_at" codec:"e,omitempty"` Metadata map[string]string `json:"metadata" codec:"m,omitempty"` PinUpdate Cid `json:"pin_update,omitempty" codec:"pu,omitempty"` Origins []Multiaddr `json:"origins" codec:"g,omitempty"` }
PinOptions wraps user-defined options for Pins
func (PinOptions) Equals ¶
func (po PinOptions) Equals(po2 PinOptions) bool
Equals returns true if two PinOption objects are equivalent. po and po2 may be nil.
func (*PinOptions) FromQuery ¶
func (po *PinOptions) FromQuery(q url.Values) error
FromQuery is the inverse of ToQuery().
func (PinOptions) ToQuery ¶
func (po PinOptions) ToQuery() (string, error)
ToQuery returns the PinOption as query arguments.
type PinPath ¶
type PinPath struct { PinOptions Path string `json:"path"` }
PinPath is a wrapper for holding pin options and path of the content.
type PinResp ¶
type PinResp struct { PinStatus IPFSPinStatus Pins []IPFSPinInfo }
type PinType ¶
type PinType uint64
PinType specifies which sort of Pin object we are dealing with. In practice, the PinType decides how a Pin object is treated by the PinTracker. See descriptions above. A sharded Pin would look like:
[ Meta ] (not pinned on IPFS, only present in cluster state)
| v
[ Cluster DAG ] (pinned everywhere in "direct")
| .. | v v
[Shard1] .. [ShardN] (allocated to peers and pinned with max-depth=1 | | .. | | | .. | v v .. v v v .. v [][]..[] [][]..[] Blocks (indirectly pinned on ipfs, not tracked in cluster)
const ( // BadType type showing up anywhere indicates a bug BadType PinType = 1 << iota // DataType is a regular, non-sharded pin. It is pinned recursively. // It has no associated reference. DataType // MetaType tracks the original CID of a sharded DAG. Its Reference // points to the Cluster DAG CID. MetaType // ClusterDAGType pins carry the CID of the root node that points to // all the shard-root-nodes of the shards in which a DAG has been // divided. Its Reference carries the MetaType CID. // ClusterDAGType pins are pinned directly everywhere. ClusterDAGType // ShardType pins carry the root CID of a shard, which points // to individual blocks on the original DAG that the user is adding, // which has been sharded. // They carry a Reference to the previous shard. // ShardTypes are pinned with MaxDepth=1 (root and // direct children only). ShardType )
PinType values. See PinType documentation for further explanation.
const AllType PinType = DataType | MetaType | ClusterDAGType | ShardType
AllType is a PinType used for filtering all pin types
func PinTypeFromString ¶
PinTypeFromString is the inverse of String. It returns the PinType value corresponding to the input string
func (PinType) MarshalJSON ¶
MarshalJSON provides json-representation of the pin type.
func (*PinType) UnmarshalJSON ¶
UnmarshalJSON provides json-representation of the pin type.
type RepoGC ¶
type RepoGC struct { Peer peer.ID `json:"peer" codec:"p,omitempty"` // the Cluster peer ID Peername string `json:"peername" codec:"pn,omitempty"` Keys []IPFSRepoGC `json:"keys" codec:"k"` Error string `json:"error,omitempty" codec:"e,omitempty"` }
RepoGC contains garbage collected CIDs from a cluster peer's IPFS daemon.
type TrackerStatus ¶
type TrackerStatus int
TrackerStatus represents the status of a tracked Cid in the PinTracker
const ( // IPFSStatus should never take this value. // When used as a filter. It means "all". TrackerStatusUndefined TrackerStatus = 0 // The cluster node is offline or not responding TrackerStatusClusterError TrackerStatus = 1 << iota // An error occurred pinning TrackerStatusPinError // An error occurred unpinning TrackerStatusUnpinError // The IPFS daemon has pinned the item TrackerStatusPinned // The IPFS daemon is currently pinning the item TrackerStatusPinning // The IPFS daemon is currently unpinning the item TrackerStatusUnpinning // The IPFS daemon is not pinning the item TrackerStatusUnpinned // The IPFS daemon is not pinning the item but it is being tracked TrackerStatusRemote // The item has been queued for pinning on the IPFS daemon TrackerStatusPinQueued // The item has been queued for unpinning on the IPFS daemon TrackerStatusUnpinQueued // The IPFS daemon is not pinning the item through this cid but it is // tracked in a cluster dag TrackerStatusSharded // The item is in the state and should be pinned, but // it is however not pinned and not queued/pinning. TrackerStatusUnexpectedlyUnpinned )
TrackerStatus values
func TrackerStatusAll ¶
func TrackerStatusAll() []TrackerStatus
TrackerStatusAll all known TrackerStatus values.
func TrackerStatusFromString ¶
func TrackerStatusFromString(str string) TrackerStatus
TrackerStatusFromString parses a string and returns the matching TrackerStatus value. The string can be a comma-separated list representing a TrackerStatus filter. Unknown status names are ignored.
func (TrackerStatus) MarshalJSON ¶
func (st TrackerStatus) MarshalJSON() ([]byte, error)
MarshalJSON uses the string representation of TrackerStatus for JSON encoding.
func (TrackerStatus) Match ¶
func (st TrackerStatus) Match(filter TrackerStatus) bool
Match returns true if the tracker status matches the given filter. For example TrackerStatusPinError will match TrackerStatusPinError and TrackerStatusError.
func (TrackerStatus) String ¶
func (st TrackerStatus) String() string
String converts a TrackerStatus into a readable string. If the given TrackerStatus is a filter (with several bits set), it will return a comma-separated list.
func (*TrackerStatus) UnmarshalJSON ¶
func (st *TrackerStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON sets a tracker status from its JSON representation.
Directories ¶
Path | Synopsis |
---|---|
Package common implements all the things that an IPFS Cluster API component must do, except the actual routes that it handles.
|
Package common implements all the things that an IPFS Cluster API component must do, except the actual routes that it handles. |
test
Package test provides utility methods to test APIs based on the common API.
|
Package test provides utility methods to test APIs based on the common API. |
Package ipfsproxy implements the Cluster API interface by providing an IPFS HTTP interface as exposed by the go-ipfs daemon.
|
Package ipfsproxy implements the Cluster API interface by providing an IPFS HTTP interface as exposed by the go-ipfs daemon. |
Package pb provides protobuf definitions for serialized types in Cluster.
|
Package pb provides protobuf definitions for serialized types in Cluster. |
Package pinsvcapi implements an IPFS Cluster API component which provides an IPFS Pinning Services API to the cluster.
|
Package pinsvcapi implements an IPFS Cluster API component which provides an IPFS Pinning Services API to the cluster. |
pinsvc
Package pinsvc contains type definitions for the Pinning Services API
|
Package pinsvc contains type definitions for the Pinning Services API |
Package rest implements an IPFS Cluster API component.
|
Package rest implements an IPFS Cluster API component. |
client
Package client provides a Go Client for the IPFS Cluster API provided by the "api/rest" component.
|
Package client provides a Go Client for the IPFS Cluster API provided by the "api/rest" component. |