spork

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

*

  • spork/spork.go
  • Copyright (c) 2021 Alvin(Xinyao) Sun <asun@matrixworld.org> *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.

*

  • spork/sporkstore.go
  • Copyright (c) 2021 Alvin(Xinyao) Sun <asun@matrixworld.org> *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockEventsToJSON

func BlockEventsToJSON(e []client.BlockEvents) []map[string]interface{}

func EventToJSON

func EventToJSON(e *cadence.Event) []map[string]interface{}

func IterQueryEventByBlockRange added in v1.0.0

func IterQueryEventByBlockRange(ctx context.Context, ss *client.Client, event string, start uint64, end uint64, defaultBatchSize uint64) ([]client.BlockEvents, error)

Types

type EventResult

type EventResult struct {
	BlockEvents []client.BlockEvents
}

func (*EventResult) JSON

func (e *EventResult) JSON() interface{}

type FlowClient added in v1.0.0

type FlowClient interface {
	String() string
	QueryEventByBlockRange(event string, start uint64, end uint64) ([]client.BlockEvents, error)
	QueryLatestBlockHeight() (uint64, error)
	SyncSpork() error
	Close() error
}

type ResolvedAccessNodeList

type ResolvedAccessNodeList struct {
	Start      uint64
	End        uint64
	AccessNode string
}

type Spork

type Spork struct {
	Name       string `json:"name"`
	RootHeight uint64 `json:"rootHeight"`
	AccessNode string `json:"accessNode"`
}

func ReadJSONFromUrl

func ReadJSONFromUrl(url string) ([]Spork, error)

type SporkAlchemy added in v1.0.0

type SporkAlchemy struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewSporkAlchemy added in v1.0.0

func NewSporkAlchemy(endPoint string, apiKey string, maxQueryBlocks uint64, queryBatchSize uint64) *SporkAlchemy

func (*SporkAlchemy) Close added in v1.0.1

func (alchemy *SporkAlchemy) Close() error

close the spork alchemy

func (*SporkAlchemy) QueryEventByBlockRange added in v1.0.0

func (alchemy *SporkAlchemy) QueryEventByBlockRange(event string, start uint64, end uint64) ([]client.BlockEvents, error)

queryEventByBlockRange

func (*SporkAlchemy) QueryLatestBlockHeight added in v1.0.0

func (alchemy *SporkAlchemy) QueryLatestBlockHeight() (uint64, error)

QueryLatestBlockHeight

func (*SporkAlchemy) String added in v1.0.0

func (alchemy *SporkAlchemy) String() string

String method return the string representation of the spork alchemy

func (*SporkAlchemy) SyncSpork added in v1.0.0

func (alchemy *SporkAlchemy) SyncSpork() error

SyncSpork with not implementation log

type SporkStore

type SporkStore struct {
	sync.Mutex

	SporkList []Spork
	// contains filtered or unexported fields
}

func NewSporkStore added in v1.0.0

func NewSporkStore(url string, maxQueryBlocks uint64, queryBatchSize uint64) *SporkStore

func (*SporkStore) Close added in v1.0.1

func (ss *SporkStore) Close() error

close connection

func (*SporkStore) QueryEventByBlockRange

func (ss *SporkStore) QueryEventByBlockRange(event string, start uint64, end uint64) ([]client.BlockEvents, error)

func (*SporkStore) QueryLatestBlockHeight

func (ss *SporkStore) QueryLatestBlockHeight() (uint64, error)

func (*SporkStore) String

func (ss *SporkStore) String() string

func (*SporkStore) SyncSpork

func (ss *SporkStore) SyncSpork() error

Jump to

Keyboard shortcuts

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