recorder

package
v0.0.0-...-d0dabfa Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

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 AddBitswapRecord(event string, cid string, info map[string]string) error

func NewTreeCache

func NewTreeCache(capacity int, selfId string) *treeCache

Types

type BitswapRecord

type BitswapRecord struct {
	Event string            `json:"event"`
	Date  int64             `json:"date"`
	Cid   string            `json:"cid"`
	Info  map[string]string `json:"info"`
}

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) AddEvent

func (n *Notifer) AddEvent(id string, eventType string, read bool, timeStamp *timestamp.Timestamp)

id - block eventType - subject timeStamp - date read - read

func (*Notifer) AddNotification

func (n *Notifer) AddNotification(notification *pb.Notification)

func (*Notifer) Flush

func (n *Notifer) Flush()

func (*Notifer) SetId

func (n *Notifer) SetId(id string)

func (*Notifer) SetTarget

func (n *Notifer) SetTarget(t string)

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) Handle

func (h *RecordService) Handle(env *pb.Envelope, pid peer.ID) (*pb.Envelope, error)

Handle is called by the underlying service handler method

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) Start

func (h *RecordService) Start()

Start begins online services

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

Jump to

Keyboard shortcuts

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