Documentation ¶
Index ¶
- Constants
- Variables
- func CopyCommonRespToIfaces(in []CommonResp) []interface{}
- func CopyIpfsIDRespToIfaces(in []IpfsIDResp) []interface{}
- func CopyRawIPFSPinInfoToIfaces(in []RawIPFSPinInfo) []interface{}
- func CopyStringSliceToIfaces(in [][]string) []interface{}
- func CopyStringToIfaces(in []string) []interface{}
- type CommonResp
- type Config
- type ErrorCode
- type IpfsIDResp
- type Knode
- type KnodeChecker
- type KnodeManager
- func (km *KnodeManager) Alerts() <-chan api.Alert
- func (km *KnodeManager) BlockGet(ctx context.Context, cid api.Cid) ([]byte, error)
- func (km *KnodeManager) BlockStream(ctx context.Context, metas <-chan api.NodeWithMeta) error
- func (km *KnodeManager) ConfigKey(keypath string) (interface{}, error)
- func (km *KnodeManager) ConnectSwarms(ctx context.Context) error
- func (km *KnodeManager) GetDiscardedMetric() api.Metric
- func (km *KnodeManager) GetMetric() []api.Metric
- func (km *KnodeManager) ID(ctx context.Context) (api.IPFSID, error)
- func (km *KnodeManager) Pin(ctx context.Context, pin api.Pin) error
- func (km *KnodeManager) PinAsync(ctx context.Context, pin api.Pin, dests []peer.ID, multiError *MultiError) error
- func (km *KnodeManager) PinLs(ctx context.Context, typeFilters []string, out chan<- api.IPFSPinInfo) error
- func (km *KnodeManager) PinLsCid(ctx context.Context, pin api.Pin) (api.PinDetail, error)
- func (km *KnodeManager) PinLsCidFromAllNode(ctx context.Context, pin api.Pin) ([]peer.ID, error)
- func (km *KnodeManager) Ready(ctx context.Context) <-chan struct{}
- func (km *KnodeManager) RepoGC(ctx context.Context) (api.RepoGC, error)
- func (km *KnodeManager) RepoStat(ctx context.Context) (api.IPFSRepoStat, error)
- func (km *KnodeManager) Resolve(ctx context.Context, path string) (api.Cid, error)
- func (km *KnodeManager) SetClient(client *rpc.Client)
- func (km *KnodeManager) SetStateTracker(tracker *stateless.Tracker)
- func (km *KnodeManager) Shutdown(ctx context.Context) error
- func (km *KnodeManager) SwarmPeers(ctx context.Context) ([]peer.ID, error)
- func (km *KnodeManager) Unpin(ctx context.Context, pin api.Pin) error
- type MultiError
- type NodeStatus
- type PinArgs
- type PinAsyncResp
- type PinLsArgs
- type PinLsResp
- type PinResp
- type RMMetric
- type RMService
- func (svc *RMService) PinCallback(ctx context.Context, pin RawIPFSPinInfo, resp *CommonResp) error
- func (svc *RMService) PushMetric(ctx context.Context, m api.KnodeMetric, resp *CommonResp) error
- func (svc *RMService) Regist(ctx context.Context, args RegisArgs, resp *CommonResp) error
- func (svc *RMService) UploadFile(ctx context.Context, args UploadFileArgs, replyType *CommonResp) error
- type RawIPFSPinInfo
- type RegisArgs
- type UploadFileArgs
Constants ¶
View Source
const DefaultMetricTTL = 30 * time.Second
Variables ¶
View Source
var CHECK_KNODE_DISCARD = 300 * time.Second
View Source
var CHECK_KNODE_INTERVAL = 60 * time.Second
检查knode健康间隔
View Source
var ErrAlertChannelFull = errors.New("alert channel is full")
View Source
var PeerMaxAlertThreshold = 1
Functions ¶
func CopyCommonRespToIfaces ¶
func CopyCommonRespToIfaces(in []CommonResp) []interface{}
func CopyIpfsIDRespToIfaces ¶
func CopyIpfsIDRespToIfaces(in []IpfsIDResp) []interface{}
func CopyRawIPFSPinInfoToIfaces ¶
func CopyRawIPFSPinInfoToIfaces(in []RawIPFSPinInfo) []interface{}
func CopyStringSliceToIfaces ¶
func CopyStringSliceToIfaces(in [][]string) []interface{}
func CopyStringToIfaces ¶
func CopyStringToIfaces(in []string) []interface{}
Types ¶
type CommonResp ¶
type CommonResp struct {
Status ErrorCode
}
type Config ¶
type Config struct { config.Saver // Host/Port for the IPFS daemon. NodeAddr []ma.Multiaddr // ConnectSwarmsDelay specifies how long to wait after startup before // attempting to open connections from this peer's IPFS daemon to the // IPFS daemons of other peers. ConnectSwarmsDelay time.Duration // knode Daemon HTTP Client POST timeout KnodeRequestTimeout time.Duration // Pin Operation timeout PinTimeout time.Duration // Unpin Operation timeout UnpinTimeout time.Duration // RepoGC Operation timeout RepoGCTimeout time.Duration // How many pin and block/put operations need to happen before we do a // special broadcast informer metrics to the network. 0 to disable. InformerTriggerInterval int // Disables the unpin operation and returns an error. UnpinDisable bool // Tracing flag used to skip tracing specific paths when not enabled. Tracing bool }
Config is used to initialize a Connector and allows to customize its behavior. It implements the config.ComponentConfig interface.
func DefaultConfig ¶
func DefaultConfig() Config
type IpfsIDResp ¶
type Knode ¶
type Knode struct { PeerID peer.ID Version string Ip string Port string // contains filtered or unexported fields }
func (*Knode) ConnectPeers ¶
ConnectPeers connect to knode swarm
type KnodeChecker ¶
type KnodeChecker struct {
// contains filtered or unexported fields
}
func NewKnodeChecker ¶
func NewKnodeChecker(ctx context.Context, manager *KnodeManager) *KnodeChecker
func (*KnodeChecker) Alerts ¶
func (kc *KnodeChecker) Alerts() <-chan api.Alert
func (*KnodeChecker) CheckAll ¶
func (kc *KnodeChecker) CheckAll()
func (*KnodeChecker) ResetAlerts ¶
func (kc *KnodeChecker) ResetAlerts(pid peer.ID)
type KnodeManager ¶
type KnodeManager struct {
// contains filtered or unexported fields
}
func NewKnodeManager ¶
func NewKnodeManager(identity *config.Identity, peerID peer.ID, controllerClient *controllerclient.ControllerConn) *KnodeManager
func (*KnodeManager) Alerts ¶
func (km *KnodeManager) Alerts() <-chan api.Alert
func (*KnodeManager) BlockStream ¶
func (km *KnodeManager) BlockStream(ctx context.Context, metas <-chan api.NodeWithMeta) error
func (*KnodeManager) ConfigKey ¶
func (km *KnodeManager) ConfigKey(keypath string) (interface{}, error)
func (*KnodeManager) ConnectSwarms ¶
func (km *KnodeManager) ConnectSwarms(ctx context.Context) error
func (*KnodeManager) GetDiscardedMetric ¶
func (km *KnodeManager) GetDiscardedMetric() api.Metric
func (*KnodeManager) GetMetric ¶
func (km *KnodeManager) GetMetric() []api.Metric
func (*KnodeManager) PinAsync ¶
func (km *KnodeManager) PinAsync(ctx context.Context, pin api.Pin, dests []peer.ID, multiError *MultiError) error
func (*KnodeManager) PinLs ¶
func (km *KnodeManager) PinLs(ctx context.Context, typeFilters []string, out chan<- api.IPFSPinInfo) error
func (*KnodeManager) PinLsCidFromAllNode ¶
PinLsCidFromAllNode 获取所有knode节点的pin 状态
func (*KnodeManager) Ready ¶
func (km *KnodeManager) Ready(ctx context.Context) <-chan struct{}
func (*KnodeManager) RepoStat ¶
func (km *KnodeManager) RepoStat(ctx context.Context) (api.IPFSRepoStat, error)
func (*KnodeManager) SetClient ¶
func (km *KnodeManager) SetClient(client *rpc.Client)
func (*KnodeManager) SetStateTracker ¶
func (km *KnodeManager) SetStateTracker(tracker *stateless.Tracker)
func (*KnodeManager) SwarmPeers ¶
type MultiError ¶
type MultiError struct {
// contains filtered or unexported fields
}
func NewMultiError ¶
func NewMultiError() MultiError
type NodeStatus ¶
type NodeStatus int
const ( CONNECTED NodeStatus = iota //已连接 REGISTED //已注册 Valid //健康可用 Invalid //心跳延迟 DISCONNECT //连接断开 DISCARDED //被丢弃的 )
type PinAsyncResp ¶
type PinAsyncResp struct {
// contains filtered or unexported fields
}
type PinLsResp ¶
type PinLsResp struct {
Pins []api.IPFSPinInfo
}
type PinResp ¶
type PinResp struct { PinStatus api.IPFSPinStatus Pins []api.IPFSPinInfo }
type RMMetric ¶
type RMMetric struct { Name string Peer peer.ID //RM节点id Group string //该RM节点所属分组 Tag string //标签,与分组一样,用于节点分配 Value string //RM管理的所有knode总可用空间 Expire int64 //本条信息过期时间 Valid bool //是否可用,既该节点是否可分配 Weight int64 //权重 Partitionable bool //是否可分区(暂不明白用法) ReceivedAt int64 //时间 KnodeList []api.KnodeMetric // 该RM管理下的knode列表) }
type RMService ¶
type RMService struct {
// contains filtered or unexported fields
}
func (*RMService) PinCallback ¶
func (svc *RMService) PinCallback(ctx context.Context, pin RawIPFSPinInfo, resp *CommonResp) error
func (*RMService) PushMetric ¶
func (svc *RMService) PushMetric(ctx context.Context, m api.KnodeMetric, resp *CommonResp) error
func (*RMService) UploadFile ¶
func (svc *RMService) UploadFile(ctx context.Context, args UploadFileArgs, replyType *CommonResp) error
type RawIPFSPinInfo ¶
type RawIPFSPinInfo struct { PeerId string `json:"PeerId" codec:"peerId"` Cid string `json:"Cid" codec:"cid"` Type string `json:"Type" codec:"type"` Message string `json:"Message" codec:"message"` Code int `json:"Code" codec:"code"` Pins []string `json:"Pins" codec:"pins"` Status ErrorCode `json:"Status" codec:"status"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.