Documentation
¶
Index ¶
- Constants
- Variables
- func AddBitswapRecord(event string, cid string, info map[string]string) error
- func NewTreeCache(capacity int, selfId string) *treeCache
- type BitswapRecord
- type BitswapRecordStore
- type Notifer
- type Record
- type RecordService
- func (h *RecordService) GetRecord(key string) ([]byte, error)
- func (h *RecordService) Handle(env *pb.Envelope, pid peer.ID) (*pb.Envelope, error)
- func (h *RecordService) HandleStream(env *pb.Envelope, pid peer.ID) (chan *pb.Envelope, chan error, chan interface{})
- func (h *RecordService) ListenRecordCh()
- func (h *RecordService) Ping(pid peer.ID) (service.PeerStatus, error)
- func (h *RecordService) Protocol() protocol.ID
- func (h *RecordService) RemoveReport(key string) error
- func (h *RecordService) SendReport(key string, peerId string) error
- func (h *RecordService) SendReportPb(report *pb.RecordReport, peerId string) error
- func (h *RecordService) Start()
- func (h *RecordService) StartRecord(key string) error
- func (h *RecordService) StartReport(key string) error
- func (h *RecordService) StopRecord(key string) error
- func (h *RecordService) StopReport(key string) error
- func (h *RecordService) WriteTreeCSV(streamId string, outPath string) error
Constants ¶
View Source
const ( Event_Final = "final" Event_ThreadAddFile = "threadAddFile" // used in core/thread_files.go/Thread.AddFiles() Event_CallIPFSGet = "ipfsGet" // used in core/thread_files.go/Thread.handleFileBlock() Event_DoneIPFSPin = "ipfsPin" Event_DoneTextileProcess = "textileProcess" Event_DoneIPFSGet = "ipfsDone" // used in core/thread_files.go/Thread.handleFileBlock() Event_DoneRecv = "recvDone" )
Use several global const variables to keep event type used in field subject in notification.
View Source
const ( Event_Bitswap_TckRecv = "tckRecv" Event_Bitswap_BlkRecv = "blkRecv" )
Variables ¶
View Source
var Hlog = honlog.Hlog
View Source
var Online = false
View Source
var RecordCh = make(chan *pb.Notification, 10)
Functions ¶
func AddBitswapRecord ¶
func NewTreeCache ¶
Types ¶
type BitswapRecord ¶
type BitswapRecordStore ¶
type BitswapRecordStore struct {
// contains filtered or unexported fields
}
type Notifer ¶
type Notifer struct {
// contains filtered or unexported fields
}
Refer to record_service.go to see how the fields of notification is used to keep record. Notifer is used to manage a series of event records, such as the adding process when add a file to thread. All these event notifications may have the same "block" and "target" field.
func NewNotifer ¶
func NewNotifer() *Notifer
func (*Notifer) AddNotification ¶
func (n *Notifer) AddNotification(notification *pb.Notification)
type Record ¶
type Record struct {
Key string `json:"key"`
//endTime time.Time
EventList []*event `json:"events"`
// contains filtered or unexported fields
}
type RecordService ¶
type RecordService struct {
// contains filtered or unexported fields
}
func NewRecordService ¶
func NewRecordService( account *keypair.Full, node func() *core.IpfsNode, sendNotification func(*pb.Notification) error, ctx context.Context, ) *RecordService
NewStreamService returns a new stream service
func (*RecordService) GetRecord ¶
func (h *RecordService) GetRecord(key string) ([]byte, error)
get one record in json format
func (*RecordService) HandleStream ¶
func (h *RecordService) HandleStream(env *pb.Envelope, pid peer.ID) (chan *pb.Envelope, chan error, chan interface{})
HandleStream is called by the underlying service handler method
func (*RecordService) ListenRecordCh ¶
func (h *RecordService) ListenRecordCh()
func (*RecordService) Ping ¶
func (h *RecordService) Ping(pid peer.ID) (service.PeerStatus, error)
Ping pings another peer
func (*RecordService) Protocol ¶
func (h *RecordService) Protocol() protocol.ID
Protocol returns the handler protocol
func (*RecordService) RemoveReport ¶
func (h *RecordService) RemoveReport(key string) error
func (*RecordService) SendReport ¶
func (h *RecordService) SendReport(key string, peerId string) error
func (*RecordService) SendReportPb ¶
func (h *RecordService) SendReportPb(report *pb.RecordReport, peerId string) error
func (*RecordService) StartRecord ¶
func (h *RecordService) StartRecord(key string) error
func (*RecordService) StartReport ¶
func (h *RecordService) StartReport(key string) error
func (*RecordService) StopRecord ¶
func (h *RecordService) StopRecord(key string) error
func (*RecordService) StopReport ¶
func (h *RecordService) StopReport(key string) error
func (*RecordService) WriteTreeCSV ¶
func (h *RecordService) WriteTreeCSV(streamId string, outPath string) error
Click to show internal directories.
Click to hide internal directories.