Documentation ¶
Index ¶
- Constants
- type Crawler
- func (c *Crawler) ConfigProvider() core.ConfigProvider
- func (c *Crawler) Connect(ch, username, org string) error
- func (c *Crawler) ConnectWithIdentity(ch, org string, identity msp.SigningIdentity) error
- func (c *Crawler) GetFromStorage(key string) (*parser.Data, error)
- func (c *Crawler) Listen(opts ...ListenOpt) error
- func (c *Crawler) ListenerForChannel(channel string) <-chan *fab.BlockEvent
- func (c *Crawler) ReadStreamFromStorage(key string) (<-chan *parser.Data, <-chan error)
- func (c *Crawler) Run()
- func (c *Crawler) SDK() *fabsdk.FabricSDK
- func (c *Crawler) StopListenAll()
- func (c *Crawler) StopListenChannel(channel string)
- type ListenOpt
- type Option
- func WithAutoConnect(username, org string, identity msp.SigningIdentity) Option
- func WithConfigProvider(configProvider core.ConfigProvider) Option
- func WithParser(p parser.Parser) Option
- func WithSDK(sdk *fabsdk.FabricSDK) Option
- func WithStorage(s storage.Storage) Option
- func WithStorageAdapter(a storageadapter.StorageAdapter) Option
Constants ¶
const ( LISTEN_FROM = "from" LISTEN_NEWEST = "newest" LISTEN_OLDEST = "oldest" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Crawler ¶
type Crawler struct {
// contains filtered or unexported fields
}
Crawler is responsible for fetching info from blockchain
func New ¶
New creates Crawler instance from HLF connection profile and returns pointer to it. "connectionProfile" is a path to HLF connection profile
func (*Crawler) ConfigProvider ¶
func (c *Crawler) ConfigProvider() core.ConfigProvider
ConfigProvider returns core.ConfigProvider instance.
func (*Crawler) Connect ¶
Connect connects crawler to channel 'ch' as identity specified in 'username' from organization with name 'org'
func (*Crawler) ConnectWithIdentity ¶
func (c *Crawler) ConnectWithIdentity(ch, org string, identity msp.SigningIdentity) error
ConnectWithIdentity connects crawler to channel 'ch' as passed signing identity from specified organization
func (*Crawler) GetFromStorage ¶
GetBlock retrieves specified data from a storage by specified key and returns it in the form of parser.Data.
func (*Crawler) Listen ¶
Listen starts blocks listener starting from block with num 'from'. All consumed blocks will be hadled by the provided parser (or default parser ParserImpl).
func (*Crawler) ListenerForChannel ¶
func (c *Crawler) ListenerForChannel(channel string) <-chan *fab.BlockEvent
func (*Crawler) ReadStreamFromStorage ¶
func (*Crawler) Run ¶
func (c *Crawler) Run()
Run starts parsing blocks and saves them to storage. The parsing strategy is determined by the implementation of the parser. What and in what form will be stored in the storage is determined by the storage adapter implementation.
func (*Crawler) StopListenAll ¶
func (c *Crawler) StopListenAll()
StopListenAll removes the registration for block events from all channels and closes these channels
func (*Crawler) StopListenChannel ¶
StopListenChannel removes the registration for block events from channel and closes the channel
type Option ¶
func WithAutoConnect ¶
func WithAutoConnect(username, org string, identity msp.SigningIdentity) Option
WithAutoConnect connects crawler to all channels specified in connection profile 'username' is a Fabric identity name and 'org' is a Fabric organization ti which the identity belongs
func WithConfigProvider ¶
func WithConfigProvider(configProvider core.ConfigProvider) Option
WithConfigProvider injects prepared core.ConfigProvider to the Crawler instance.
func WithParser ¶
WithParser injects a specific parser that satisfies the Parser interface to the Crawler instance. If no parser is specified, the default parser ParserImpl will be used.
func WithStorage ¶
WithStorage adds a specific storage that satisfies the Storage interface to the Crawler instance. If no storage is specified, the default storage Badger (BadgerDB) will be used.
func WithStorageAdapter ¶
func WithStorageAdapter(a storageadapter.StorageAdapter) Option
WithStorageAdapter adds storage adapter that satisfies the StorageAdapter interface to the Crawler instance. If no storage adapter is specified, the default SimpleAdapter will be used.
Directories ¶
Path | Synopsis |
---|---|
Google cloud Pub/Sub implementation of Storage Google cloud Pub/Sub implementation of Storage
|
Google cloud Pub/Sub implementation of Storage Google cloud Pub/Sub implementation of Storage |