Documentation
¶
Index ¶
- Constants
- type BlockLog
- type ChangeDataMaker
- type GenericChange
- type InterestedChange
- type InternalStateChangeSlice
- type OperationLog
- type StateChange
- type StateChangeContext
- func (ctx *StateChangeContext) AddChange(what, kind string, change *GenericChange)
- func (ctx *StateChangeContext) Cause() string
- func (ctx *StateChangeContext) CauseExtra() map[string]interface{}
- func (ctx *StateChangeContext) Changes() InternalStateChangeSlice
- func (ctx *StateChangeContext) ClearChanges()
- func (ctx *StateChangeContext) PopAndPushCause(cause string)
- func (ctx *StateChangeContext) PopCause()
- func (ctx *StateChangeContext) PushCause(cause string)
- func (ctx *StateChangeContext) PutCauseExtra(key string, value interface{})
- func (ctx *StateChangeContext) Restore(restorePoint int)
- func (ctx *StateChangeContext) RestorePoint() int
- func (ctx *StateChangeContext) SetCause(cause string)
- func (ctx *StateChangeContext) SetOperation(op int)
- func (ctx *StateChangeContext) SetTrxAndOperation(trxId string, op int)
- type TransactionLog
- type Watcher
- func (w *Watcher) BeginBlock(blockNum uint64) error
- func (w *Watcher) CurrentBlockContext() (ctx *StateChangeContext)
- func (w *Watcher) EndBlock(ok bool, block *prototype.SignedBlock) error
- func (w *Watcher) GetOrCreateStateChangeContext(branch string, trxId string, op int, cause string) (ctx *StateChangeContext)
- type WatcherCallback
Constants ¶
View Source
const ( ChangeKindCreate = "create" ChangeKindUpdate = "update" ChangeKindDelete = "delete" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockLog ¶
type BlockLog struct {
BlockId string `json:"id"`
BlockNum uint64 `json:"num"`
BlockTime uint32 `json:"time"`
Transactions []*TransactionLog `json:"trxs"`
Changes []*StateChange `json:"changes"`
}
func (*BlockLog) FromJsonString ¶
func (*BlockLog) ToJsonString ¶
type ChangeDataMaker ¶
type ChangeDataMaker func(id, before, after interface{}) *GenericChange
type GenericChange ¶
type GenericChange struct {
Id interface{} `json:"id"`
Before interface{} `json:"before"`
After interface{} `json:"after"`
}
type InterestedChange ¶
type InterestedChange struct {
Table *table.TableInfo
Field string
Maker ChangeDataMaker
}
type InternalStateChangeSlice ¶
type InternalStateChangeSlice []*internalStateChange
type OperationLog ¶
type OperationLog struct {
Type string `json:"type"`
Data *prototype.Operation `json:"data"`
Changes []*StateChange `json:"changes"`
}
type StateChange ¶
type StateChange struct {
What string `json:"what"`
Kind string `json:"kind"`
Cause string `json:"cause"`
CauseExtra map[string]interface{} `json:"cause_extra"`
Change *GenericChange `json:"change"`
}
type StateChangeContext ¶
type StateChangeContext struct {
// contains filtered or unexported fields
}
func (*StateChangeContext) AddChange ¶
func (ctx *StateChangeContext) AddChange(what, kind string, change *GenericChange)
func (*StateChangeContext) Cause ¶
func (ctx *StateChangeContext) Cause() string
func (*StateChangeContext) CauseExtra ¶
func (ctx *StateChangeContext) CauseExtra() map[string]interface{}
func (*StateChangeContext) Changes ¶
func (ctx *StateChangeContext) Changes() InternalStateChangeSlice
func (*StateChangeContext) ClearChanges ¶
func (ctx *StateChangeContext) ClearChanges()
func (*StateChangeContext) PopAndPushCause ¶
func (ctx *StateChangeContext) PopAndPushCause(cause string)
func (*StateChangeContext) PopCause ¶
func (ctx *StateChangeContext) PopCause()
func (*StateChangeContext) PushCause ¶
func (ctx *StateChangeContext) PushCause(cause string)
func (*StateChangeContext) PutCauseExtra ¶
func (ctx *StateChangeContext) PutCauseExtra(key string, value interface{})
func (*StateChangeContext) Restore ¶
func (ctx *StateChangeContext) Restore(restorePoint int)
func (*StateChangeContext) RestorePoint ¶
func (ctx *StateChangeContext) RestorePoint() int
func (*StateChangeContext) SetCause ¶
func (ctx *StateChangeContext) SetCause(cause string)
func (*StateChangeContext) SetOperation ¶
func (ctx *StateChangeContext) SetOperation(op int)
func (*StateChangeContext) SetTrxAndOperation ¶
func (ctx *StateChangeContext) SetTrxAndOperation(trxId string, op int)
type TransactionLog ¶
type TransactionLog struct {
TrxId string `json:"id"`
Receipt *prototype.TransactionReceipt `json:"receipt"`
Operations []*OperationLog `json:"ops"`
}
type Watcher ¶
func NewWatcher ¶
func NewWatcher(dbSvcId uint32, callback WatcherCallback) (w *Watcher)
func (*Watcher) BeginBlock ¶
func (*Watcher) CurrentBlockContext ¶
func (w *Watcher) CurrentBlockContext() (ctx *StateChangeContext)
func (*Watcher) GetOrCreateStateChangeContext ¶
type WatcherCallback ¶
Click to show internal directories.
Click to hide internal directories.