og

package
v0.0.0-...-a53bfeb Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const EngineCheckIntervalSeconds = 1

Variables

View Source
var PingCheckIntervalSeconds = 1
View Source
var Protocol = "og/1.0.0"

Functions

func Keccak256

func Keccak256(data ...[]byte) []byte

Types

type BlsConsensusAccountProvider

type BlsConsensusAccountProvider struct {
	BackFilePath string
	// contains filtered or unexported fields
}

func (*BlsConsensusAccountProvider) Generate

func (*BlsConsensusAccountProvider) Load

func (*BlsConsensusAccountProvider) ProvideAccount

func (*BlsConsensusAccountProvider) Save

func (b *BlsConsensusAccountProvider) Save() (err error)

type CachedPrivateGenerator

type CachedPrivateGenerator struct {
	Refresh bool
	Reader  io.Reader
	// contains filtered or unexported fields
}

func (*CachedPrivateGenerator) GeneratePair

func (p *CachedPrivateGenerator) GeneratePair(typ int) (privKey crypto.PrivKey, pubKey crypto.PubKey, err error)

type CommunityManager

type CommunityManager interface {
}

type DefaultCommunityManager

type DefaultCommunityManager struct {
	NodeInfoProvider      og_interface.NodeInfoProvider
	PhysicalCommunicator  *transport.PhysicalCommunicator
	KnownPeerListFilePath string
	// contains filtered or unexported fields
}

DefaultCommunityManager manages relationship with other peers. It keeps the community with a stable scale。 It also tries to balance the whole network to prevent some node being too heavy loaded

func (*DefaultCommunityManager) AddSubscriberNewOutgoingMessageEvent

func (d *DefaultCommunityManager) AddSubscriberNewOutgoingMessageEvent(sub transport_interface.NewOutgoingMessageEventSubscriber)

subscribe mine

func (*DefaultCommunityManager) AddSubscriberPeerJoinedEvent

func (d *DefaultCommunityManager) AddSubscriberPeerJoinedEvent(sub og_interface.PeerJoinedEventSubscriber)

func (*DefaultCommunityManager) AddSubscriberPeerLeftEvent

func (d *DefaultCommunityManager) AddSubscriberPeerLeftEvent(sub og_interface.PeerLeftEventSubscriber)

func (*DefaultCommunityManager) GetPeerConnectedEventChannel

func (d *DefaultCommunityManager) GetPeerConnectedEventChannel() chan *transport_interface.PeerEvent

func (*DefaultCommunityManager) GetPeerDisconnectedEventChannel

func (d *DefaultCommunityManager) GetPeerDisconnectedEventChannel() chan *transport_interface.PeerEvent

func (*DefaultCommunityManager) InitDefault

func (d *DefaultCommunityManager) InitDefault()

func (*DefaultCommunityManager) Name

func (d *DefaultCommunityManager) Name() string

func (*DefaultCommunityManager) NewIncomingMessageEventChannel

func (d *DefaultCommunityManager) NewIncomingMessageEventChannel() chan *transport_interface.IncomingLetter

my subscriptions

func (*DefaultCommunityManager) SendPing

func (d *DefaultCommunityManager) SendPing(peer string)

func (*DefaultCommunityManager) Start

func (d *DefaultCommunityManager) Start()

func (*DefaultCommunityManager) StaticSetup

func (d *DefaultCommunityManager) StaticSetup()

func (*DefaultCommunityManager) Stop

func (d *DefaultCommunityManager) Stop()

type LedgerAccountLocalStorage

type LedgerAccountLocalStorage struct {
	CryptoType int32
	PubKey     string
	PrivKey    string
	Address    string
}

type LocalLedgerAccountProvider

type LocalLedgerAccountProvider struct {
	PrivateGenerator og_interface.PrivateGenerator
	AddressConverter og_interface.AddressConverter
	BackFilePath     string
	CryptoType       og_interface.CryptoType
	// contains filtered or unexported fields
}

func (*LocalLedgerAccountProvider) Generate

func (l *LocalLedgerAccountProvider) Generate() (account *og_interface.OgLedgerAccount, err error)

func (*LocalLedgerAccountProvider) Load

func (*LocalLedgerAccountProvider) ProvideAccount

func (*LocalLedgerAccountProvider) Save

func (l *LocalLedgerAccountProvider) Save() (err error)

func (*LocalLedgerAccountProvider) SetAccount

type LocalTransportAccountProvider

type LocalTransportAccountProvider struct {
	PrivateGenerator   og_interface.PrivateGenerator
	NetworkIdConverter NetworkIdConverter
	BackFilePath       string
	CryptoType         transport_interface.CryptoType
	// contains filtered or unexported fields
}

func (*LocalTransportAccountProvider) Account

func (*LocalTransportAccountProvider) Generate

func (*LocalTransportAccountProvider) Load

only private key is mandatory.

func (*LocalTransportAccountProvider) ProvideAccount

func (*LocalTransportAccountProvider) Save

func (l *LocalTransportAccountProvider) Save() (err error)

func (*LocalTransportAccountProvider) SetAccount

type NetworkIdConverter

type NetworkIdConverter interface {
	NetworkIdFromAccount(account *transport_interface.TransportAccount) (networkId string, err error)
}

type OGResourceFetcher

type OGResourceFetcher struct {
}

func (OGResourceFetcher) Fetch

type OgAddressConverter

type OgAddressConverter struct {
}

func (*OgAddressConverter) AddressFromAccount

func (o *OgAddressConverter) AddressFromAccount(account *og_interface.OgLedgerAccount) (addr og_interface.Address, err error)

type OgEngine

type OgEngine struct {
	Ledger           og_interface.Ledger
	CommunityManager CommunityManager
	NetworkId        string
	// contains filtered or unexported fields
}

func (*OgEngine) AddSubscriberNewHeightDetectedEvent

func (o *OgEngine) AddSubscriberNewHeightDetectedEvent(sub og_interface.NewHeightDetectedEventSubscriber)

func (*OgEngine) AddSubscriberNewOutgoingMessageEvent

func (o *OgEngine) AddSubscriberNewOutgoingMessageEvent(sub transport_interface.NewOutgoingMessageEventSubscriber)

func (*OgEngine) CurrentHeight

func (o *OgEngine) CurrentHeight() int64

func (*OgEngine) EventChannelPeerJoined

func (o *OgEngine) EventChannelPeerJoined() chan *og_interface.PeerJoinedEvent

func (*OgEngine) GetBenchmarks

func (o *OgEngine) GetBenchmarks() map[string]interface{}

func (*OgEngine) GetNetworkId

func (o *OgEngine) GetNetworkId() string

func (*OgEngine) InitDefault

func (o *OgEngine) InitDefault()

func (*OgEngine) Name

func (o *OgEngine) Name() string

func (*OgEngine) NewIncomingMessageEventChannel

func (o *OgEngine) NewIncomingMessageEventChannel() chan *transport_interface.IncomingLetter

func (*OgEngine) Start

func (o *OgEngine) Start()

func (*OgEngine) StaticSetup

func (o *OgEngine) StaticSetup()

func (*OgEngine) Stop

func (o *OgEngine) Stop()

type OgNetworkIdConverter

type OgNetworkIdConverter struct {
}

OgNetworkIdConverter converts private/public key to network id that libp2p use.

func (*OgNetworkIdConverter) NetworkIdFromAccount

func (o *OgNetworkIdConverter) NetworkIdFromAccount(account *transport_interface.TransportAccount) (networkId string, err error)

type TransportAccountLocalStorage

type TransportAccountLocalStorage struct {
	CryptoType int32
	PubKey     string
	PrivKey    string
	NetworkId  string
}

type TransportAccountProvider

type TransportAccountProvider interface {
	ProvideAccount() (*transport_interface.TransportAccount, error)
	Generate() (account *transport_interface.TransportAccount, err error)
	Load() (account *transport_interface.TransportAccount, err error)
	Save() (err error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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