Documentation ¶
Index ¶
- Constants
- type ChangeLog
- type EventLog
- type Log
- type LogTree
- type LogTreeNode
- type RawLog
- type RawLogType
- type ResultLog
- type StatusLog
- type TimePoint
- type Timeline
- func (tl *Timeline) GetPointBefore(pivot Timestamp) Timeline
- func (tl *Timeline) GetPointByRange(start, end Timestamp) Timeline
- func (tl *Timeline) GetPointByTime(pivot Timestamp) Timeline
- func (tl *Timeline) GetPointByType(t RawLogType) Timeline
- func (tl *Timeline) GetPointSince(pivot Timestamp) Timeline
- func (tl *Timeline) PushPoint(points ...TimePoint)
- type Timestamp
Constants ¶
const ( ChangeTypeTx = RawLogType("change_tx") ChangeTypeBlock = RawLogType("change_block") // ChangeTypeChain 目前只关注 change chain,每一种 change 对应独立的日志文件 ChangeTypeChain = RawLogType("change_chain") ChangeTypeChain_Create = RawLogType("change_chain_create") ChangeTypeChain_Remove = RawLogType("change_chain_remove") ChangeTypeChain_Extend = RawLogType("change_chain_extend") ChangeTypeChain_Reduce = RawLogType("change_chain_reduce") ChangeTypeChain_Fork = RawLogType("change_chain_fork") ChangeTypeChain_Reorganize = RawLogType("change_chain_reorganize") ChangeTypeNetwork = RawLogType("change_network") ChangeTypeUnknown = RawLogType("change_unknown") )
ChangeType
const ( StatueTypeTx = RawLogType("status_tx") StatueTypeBlock = RawLogType("status_block") StatueTypeChain = RawLogType("status_chain") StatueTypeNetwork = RawLogType("status_network") StatusTypeUnknown = RawLogType("status_unknown") )
StatusType
const ( // EventTypeBlock_Arrival arrival EventTypeBlock_Arrival = RawLogType("event_block_arrival") // EventTypeBlock_Verify verify EventTypeBlock_Verify = RawLogType("event_block_verify") // EventTypeBlock_Genesis genesis EventTypeBlock_Genesis = RawLogType("event_block_genesis") // EventTypeBlock_Connect connect EventTypeBlock_Connect = RawLogType("event_block_connect") // EventTypeBlock_Orphan orphan EventTypeBlock_Orphan = RawLogType("event_block_orphan") // EventTypeBlock_Stale stale EventTypeBlock_Stale = RawLogType("event_block_stale") // EventTypeBlock_Disconnect disconnect EventTypeBlock_Disconnect = RawLogType("event_block_disconnect") )
EventType for StatusTypeBlock
const ( EventTypeNetwork = RawLogType("event_network") EventTypeUnknown = RawLogType("event_unknown") )
EventType for StatusTypeNetwork
const ( ResultTypeBlock_VerifySuccess = RawLogType("result_block_verify_success") ResultTypeBlock_VerifyFailed = RawLogType("result_block_verify_failed") ResultTypeBlock_Connect_MainChain = RawLogType("result_block_connect_mainchain") // extending mainchain ResultTypeBlock_Connect_SideChain = RawLogType("result_block_connect_sidechain") // extending or creating a sidechain ResultTypeBlock_Connect_Attach = RawLogType("result_block_connect_attach") // if reorganize attach into mainchain ResultTypeBlock_Connect_Detach = RawLogType("result_block_connect_detach") // if reorganize detach from mainchain ResultTypeBlock_Connect_BecomeOrphan = RawLogType("result_block_connect_become_orphan") // become orphan when connect parent not exist ResultTypeBlock_Connect_BecomeStale = RawLogType("result_block_connect_become_stale") // become stale when detach ResultTypeBlock_Connect_BecomeBest = RawLogType("result_block_connect_become_best") // become best when connect or attach ResultTypeBlock_Orphan_BecomeStale = RawLogType("result_block_orphan_become_stale") // become stale when connect into orphan ResultTypeBlock_Orphan_AddIntoPool = RawLogType("result_block_orphan_add_into_pool") // orphan store into orphan pool ResultTypeBlock_Orphan_ExpireDiscard = RawLogType("result_block_orphan_expire_discard") // orphan discard when expire in orphan pool ResultTypeBlock_Stale_AddIntoPool = RawLogType("result_block_stale_add_into_pool") // stale store into orphan pool ResultTypeBlock_Stale_Discard = RawLogType("result_block_stale_add_into_pool") // stale discard when detach or expire in orphan pool ResultTypeBlock_Disconnect_MainChain = RawLogType("result_block_disconnect_mainchain") ResultTypeBlock_Disconnect_SideChain = RawLogType("result_block_disconnect_sidechain") ResultTypeBlock_Disconnect_BecomeStale = RawLogType("result_block_disconnect_become_stale") // become stale when disconnect from mainchain or sidechain )
ResultType for EventTypeBlock
const ( ResultTypeNetwork = RawLogType("result_network") ResultTypeUnknown = RawLogType("result_unknown") )
ResultType for EventTypeNetwork
const ( // EventTypeChain chain EventTypeChain = RawLogType("event_chain") )
EventType for StatusTypeChain
const ( // EventTypeTx tx EventTypeTx = RawLogType("event_tx") )
EventType for StatusTypeTx
const ( // ResultTypeChain chain ResultTypeChain = RawLogType("result_chain") )
ResultType for EventTypeChain
const ( // ResultTypeTx tx ResultTypeTx = RawLogType("result_tx") )
ResultType for EventTypeTx
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangeLog ¶
type EventLog ¶
type LogTree ¶
type LogTree struct { Root *RawLog `json:"root"` // *ChangeLog raw Children map[RawLogType][]*LogTreeNode `json:"children"` // map[StatusType][]*StatusLog raw }
func NewLogTree ¶
func NewLogTree() *LogTree
func (*LogTree) GetChild ¶
func (tree *LogTree) GetChild(logType RawLogType) (*LogTreeNode, error)
type LogTreeNode ¶
type LogTreeNode struct { Node *RawLog `json:"node"` // StatusLog raw NodeChildren []*RawLog `json:"node_children"` // []*EventLog raw }
func NewLogTreeNode ¶
func NewLogTreeNode(status *RawLog) *LogTreeNode
func (*LogTreeNode) AddNodeChild ¶
func (node *LogTreeNode) AddNodeChild(event *RawLog)
type RawLog ¶
type RawLog struct { Type RawLogType `json:"type"` Timestamp Timestamp `json:"timestamp"` Raw []byte `json:"raw"` }
RawLog parsing from the logs output by btcd
type RawLogType ¶
type RawLogType string
func (RawLogType) String ¶
func (t RawLogType) String() string
type ResultLog ¶
type StatusLog ¶
type Timeline ¶
func NewTimeline ¶
func (*Timeline) GetPointBefore ¶
GetPointBefore find the TimestampStatus Before the time point
func (*Timeline) GetPointByRange ¶
GetPointByRange find range TimestampStatus between start and end
func (*Timeline) GetPointByTime ¶
GetPointByTime find left and right TimestampStatus about the pivot
func (*Timeline) GetPointByType ¶
func (tl *Timeline) GetPointByType(t RawLogType) Timeline
GetPointByType find the TimestampStatus that Type in ts
func (*Timeline) GetPointSince ¶
GetPointSince find the TimestampStatus Since the time point
type Timestamp ¶
type Timestamp int64
func (Timestamp) FormatString ¶
TODO add more method about Timestamp
func (Timestamp) FormatTime ¶
TODO add more method about Timestamp