Documentation ¶
Overview ¶
Interface that allows factomd to offload the dbstate fetching to this plugin. If offloaded, factomd will need to drain the buffer by launching a drain go routine
Index ¶
- Variables
- func AddInterruptHandler(handler func())
- func AddNode()
- func AddSimPeer(fnodes []*FactomNode, i1 int, i2 int)
- func ComposeEcTransaction(inSec interfaces.IHash, outEC interfaces.IHash, ...) (*factoid.Transaction, error)
- func ComposeFctTransaction(amt uint64, inSec interfaces.IHash, outPub interfaces.IHash, ecPrice uint64) (*factoid.Transaction, error)
- func Factomd(params *FactomParams, listenToStdin bool) interfaces.IState
- func FaultSummary() string
- func FundECWallet(st *state.State, inSec interfaces.IHash, outEC interfaces.IHash, amt uint64) (error, string)
- func FundWallet(st *state.State, amt uint64) (error, string)
- func FundWalletTOFF(st *state.State, timeOffsetInMilliseconds int64, amt uint64) (error, string)
- func GetBalance(s *state.State, userStr string) int64
- func GetBalanceEC(s *state.State, userStr string) int64
- func GetLine(listenToStdin bool) string
- func GetSystemStatus(listenTo int, wsapiNode int) string
- func HandleLogfiles(stdoutlog string, stderrlog string)
- func InvalidOutputs(fnode *FactomNode)
- func LaunchDBStateManagePlugin(path string, inQueue interfaces.IQueue, s *state.State, ...) (interfaces.IManagerController, error)
- func LaunchDebugServer(service string)
- func LoadJournal(s interfaces.IState, journal string)
- func LoadJournalFromReader(s interfaces.IState, r *bufio.Reader)
- func LoadJournalFromString(s interfaces.IState, journalStr string)
- func NetStart(s *state.State, p *FactomParams, listenToStdin bool)
- func NetworkOutputs(fnode *FactomNode)
- func NetworkProcessorNet(fnode *FactomNode)
- func NewTransaction(amt uint64, userSecretIn string, userPublicOut string, ecPrice uint64) (*factoid.Transaction, error)
- func ParseCmdLine(args []string) *FactomParams
- func Peers(fnode *FactomNode)
- func PostTransaction(st *state.State, trans *factoid.Transaction) (error, string)
- func PrintBusy(state interfaces.IState, i int)
- func PrintOneStatus(listenTo int, wsapiNode int)
- func RandomEntry() *entryBlock.Entry
- func RandomFctAddressPair() (string, string)
- func RegisterPrometheus()
- func SendTxn(s *state.State, amt uint64, userSecretIn string, userPubOut string, ...) (*factoid.Transaction, error)
- func SimControl(listenTo int, listenStdin bool)
- func StartProfiler(mpr int, expose bool)
- func SystemFaults(f *FactomNode) string
- func Timer(state interfaces.IState)
- type CompletedHeightsManager
- type FactomMessage
- type FactomNode
- type IManagerPlugin
- type IManagerPluginRPC
- func (g *IManagerPluginRPC) Alive() error
- func (g *IManagerPluginRPC) CompletedHeightTo(height uint32) error
- func (g *IManagerPluginRPC) FetchFromBuffer() []byte
- func (g *IManagerPluginRPC) IsBufferEmpty() bool
- func (g *IManagerPluginRPC) RetrieveDBStateByHeight(height uint32) error
- func (g *IManagerPluginRPC) SetSigningKey(sec []byte) error
- func (g *IManagerPluginRPC) UploadDBStateBytes(data []byte, sign bool) error
- func (g *IManagerPluginRPC) UploadIfOnDisk(height uint32) bool
- type IManagerPluginRPCServer
- func (s *IManagerPluginRPCServer) Alive(args interface{}, resp *error) error
- func (s *IManagerPluginRPCServer) CompletedHeightTo(height uint32, resp *error) error
- func (s *IManagerPluginRPCServer) FetchFromBuffer(args interface{}, resp *[]byte) error
- func (s *IManagerPluginRPCServer) IsBufferEmpty(args interface{}, resp *bool) error
- func (s *IManagerPluginRPCServer) RetrieveDBStateByHeight(height uint32, resp *error) error
- func (s *IManagerPluginRPCServer) SetSigningKey(key []byte, resp *error) error
- func (s *IManagerPluginRPCServer) UploadDBStateBytes(args *UploadDBStateArgs, resp *error) error
- func (s *IManagerPluginRPCServer) UploadIfOnDisk(height uint32, resp *bool) error
- type LoadGenerator
- func (lg *LoadGenerator) KeepUsFunded()
- func (lg *LoadGenerator) NewCommitChain(entry *entryBlock.Entry) *messages.CommitChainMsg
- func (lg *LoadGenerator) NewCommitEntry(entry *entryBlock.Entry) *messages.CommitEntryMsg
- func (lg *LoadGenerator) NewRevealEntry(entry *entryBlock.Entry) *messages.RevealEntryMsg
- func (lg *LoadGenerator) Run()
- func (lg *LoadGenerator) Stop()
- type MsgLog
- type P2PProxy
- func (f *P2PProxy) BytesIn() int
- func (f *P2PProxy) BytesOut() int
- func (f *P2PProxy) Equals(ff interfaces.IPeer) bool
- func (f *P2PProxy) GetNameFrom() string
- func (f *P2PProxy) GetNameTo() string
- func (f *P2PProxy) Init(fromName, toName string) interfaces.IPeer
- func (f *P2PProxy) Len() int
- func (f *P2PProxy) ManageInChannel()
- func (f *P2PProxy) ManageOutChannel()
- func (f *P2PProxy) Receive() (interfaces.IMsg, error)
- func (f *P2PProxy) Send(msg interfaces.IMsg) error
- func (f *P2PProxy) SetWeight(w int)
- func (p *P2PProxy) StartProxy()
- func (p *P2PProxy) StopProxy()
- func (f *P2PProxy) Weight() int
- type SimPacket
- type SimPeer
- func (f *SimPeer) BytesIn() int
- func (f *SimPeer) BytesOut() int
- func (f *SimPeer) Equals(ff interfaces.IPeer) bool
- func (f *SimPeer) GetNameFrom() string
- func (f *SimPeer) GetNameTo() string
- func (f *SimPeer) Init(fromName, toName string) interfaces.IPeer
- func (f *SimPeer) Len() int
- func (f *SimPeer) Receive() (interfaces.IMsg, error)
- func (f *SimPeer) Send(msg interfaces.IMsg) error
- func (*SimPeer) Weight() int
- type UploadDBStateArgs
Constants ¶
This section is empty.
Variables ¶
var ( // Messages RepeatMsgs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_msg_replay_toss_total", Help: "Number of repeated msgs.", }) BroadInCastQueue = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_broadcast_in_current", Help: "Number of msgs in broadcastin queue.", }) BroadCastInQueueDrop = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_broadcast_in_drop_total", Help: "How many messages are dropped due to full queues", }) // NetworkReplayFilter TotalNetworkReplayFilter = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_network_replay_filter_total", Help: "Tally of total messages gone into NetworkReplayFilter", }) TotalNetworkAckReplayFilter = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_network_ack_replay_filter_total", Help: "Tally of total messages gone into NetworkAckReplayFilter", }) // Network Out Queue NetworkOutTotalDequeue = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_queue_netoutmsg_total_general", Help: "Count of all messages being dequeued", }) // Send/Receive Times TotalSendTime = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_total_send_time", Help: "Time spent sending (nanoseconds)", }) TotalReceiveTime = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_total_receive_time", Help: "Time spent receiving (nanoseconds)", }) )
var Build string
Build sets the factomd build id using git's SHA Version sets the semantic version number of the build $ go install -ldflags "-X github.com/FactomProject/factomd/engine.Build=`git rev-parse HEAD` -X github.com/FactomProject/factomd/engine.=`cat VERSION`" It also seems to need to have the previous binary deleted if recompiling to have this message show up if no code has changed. Since we are tracking code changes, then there is no need to delete the binary to use the latest message
var CHECK_BUFFER time.Duration = 2 * time.Second
How often to check the plugin if it has messages ready
var FactomdVersion string = "BuiltWithoutVersion"
var LOCAL_NET_PRIV_KEY string = "4c38c72fc5cdad68f13b74674d3ffb1f3d63a112710868c9b08946553448d26d"
Used for signing messages
var ListenTo int
var (
STACK_HEIGHT = 100
)
var SortByID bool
var VerboseAuthorityDeltas = false
var VerboseAuthoritySet = false
var VerboseFaultOutput = false
Functions ¶
func AddInterruptHandler ¶
func AddInterruptHandler(handler func())
AddInterruptHandler adds a handler to call when a SIGINT (Ctrl+C) is received.
func AddSimPeer ¶
func AddSimPeer(fnodes []*FactomNode, i1 int, i2 int)
func ComposeEcTransaction ¶
func ComposeEcTransaction(inSec interfaces.IHash, outEC interfaces.IHash, timeInMilliseconds *primitives.Timestamp, amt uint64, ecPrice uint64) (*factoid.Transaction, error)
create a transaction to buy Entry Credits this adds the EC fee on top of the input amount
func ComposeFctTransaction ¶
func ComposeFctTransaction(amt uint64, inSec interfaces.IHash, outPub interfaces.IHash, ecPrice uint64) (*factoid.Transaction, error)
create a transaction to transfer FCT between addresses adds EC fee on top of input amount
func Factomd ¶
func Factomd(params *FactomParams, listenToStdin bool) interfaces.IState
func FaultSummary ¶
func FaultSummary() string
func FundECWallet ¶
func FundECWallet(st *state.State, inSec interfaces.IHash, outEC interfaces.IHash, amt uint64) (error, string)
FundECWallet get the current time in ms, add to it the offset provided (usually zero, except for tests)
func FundWallet ¶
FundWallet() Entry Point for no time offset on the transaction.
func FundWalletTOFF ¶
FundWalletTOFF() Entry Point where test code allows the transaction to have a time offset from the current time.
func GetSystemStatus ¶
func HandleLogfiles ¶
func LaunchDBStateManagePlugin ¶
func LaunchDBStateManagePlugin(path string, inQueue interfaces.IQueue, s *state.State, sigKey *primitives.PrivateKey, memProfileRate int) (interfaces.IManagerController, error)
LaunchDBStateManagePlugin launches the plugin and returns an interface that can be interacted with like a usual interface. The client returned must be killed before we exit
func LaunchDebugServer ¶
func LaunchDebugServer(service string)
func LoadJournal ¶
func LoadJournal(s interfaces.IState, journal string)
func LoadJournalFromReader ¶
func LoadJournalFromReader(s interfaces.IState, r *bufio.Reader)
func LoadJournalFromString ¶
func LoadJournalFromString(s interfaces.IState, journalStr string)
func NetworkOutputs ¶
func NetworkOutputs(fnode *FactomNode)
func NetworkProcessorNet ¶
func NetworkProcessorNet(fnode *FactomNode)
func NewTransaction ¶
func NewTransaction(amt uint64, userSecretIn string, userPublicOut string, ecPrice uint64) (*factoid.Transaction, error)
construct a new factoid transaction
func ParseCmdLine ¶
func ParseCmdLine(args []string) *FactomParams
func Peers ¶
func Peers(fnode *FactomNode)
func PostTransaction ¶
create wsapi Post and invoke v2Request handler
func PrintBusy ¶
func PrintBusy(state interfaces.IState, i int)
func PrintOneStatus ¶
func RandomEntry ¶
func RandomEntry() *entryBlock.Entry
func RandomFctAddressPair ¶
generate a pair of user-strings Fs.., FA..
func RegisterPrometheus ¶
func RegisterPrometheus()
RegisterPrometheus registers the variables to be exposed. This can only be run once, hence the boolean flag to prevent panics if launched more than once. This is called in NetStart
func SendTxn ¶
func SendTxn(s *state.State, amt uint64, userSecretIn string, userPubOut string, ecPrice uint64) (*factoid.Transaction, error)
SendTxn() adds transaction to APIQueue bypassing the wsapi / json encoding
func SimControl ¶
func StartProfiler ¶
StartProfiler runs the go pprof tool `go tool pprof http://localhost:6060/debug/pprof/profile` https://golang.org/pkg/net/http/pprof/
func SystemFaults ¶
func SystemFaults(f *FactomNode) string
func Timer ¶
func Timer(state interfaces.IState)
Types ¶
type CompletedHeightsManager ¶
CompletedHeightsManager ensures the same height is not processed many times
func NewCompletedHeightManager ¶
func NewCompletedHeightManager() *CompletedHeightsManager
func (*CompletedHeightsManager) ClearTo ¶
func (c *CompletedHeightsManager) ClearTo(height int)
ClearTo will indicate anything below this height is no longer needed
func (*CompletedHeightsManager) CompleteHeight ¶
func (c *CompletedHeightsManager) CompleteHeight(height int) bool
CompleteHeight will signal a height has been completed. It will return a boolean value to indicate whether or not to allow this height to be added to the inmsg queue
type FactomMessage ¶
func (*FactomMessage) JSONByte ¶
func (e *FactomMessage) JSONByte() ([]byte, error)
func (*FactomMessage) JSONString ¶
func (e *FactomMessage) JSONString() (string, error)
func (*FactomMessage) String ¶
func (e *FactomMessage) String() string
type FactomNode ¶
type FactomNode struct { Index int State *state.State Peers []interfaces.IPeer MLog *MsgLog P2PIndex int }
func GetFnodes ¶
func GetFnodes() []*FactomNode
func GetFocus ¶
func GetFocus() *FactomNode
type IManagerPlugin ¶
type IManagerPlugin struct { // Impl Injection Impl interfaces.IManagerController }
This is the implementation of plugin.Plugin so we can serve/consume this
This has two methods: Server must return an RPC server for this plugin type. We construct a IManagerPluginRPCServer for this.
Client must return an implementation of our interface that communicates over an RPC client. We return IManagerPluginRPC for this.
Ignore MuxBroker. That is used to create more multiplexed streams on our plugin connection and is a more advanced use case.
func (IManagerPlugin) Client ¶
func (IManagerPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)
func (*IManagerPlugin) Server ¶
func (p *IManagerPlugin) Server(*plugin.MuxBroker) (interface{}, error)
type IManagerPluginRPC ¶
type IManagerPluginRPC struct {
// contains filtered or unexported fields
}
Here is an implementation that talks over RPC
func (*IManagerPluginRPC) Alive ¶
func (g *IManagerPluginRPC) Alive() error
func (*IManagerPluginRPC) CompletedHeightTo ¶
func (g *IManagerPluginRPC) CompletedHeightTo(height uint32) error
func (*IManagerPluginRPC) FetchFromBuffer ¶
func (g *IManagerPluginRPC) FetchFromBuffer() []byte
func (*IManagerPluginRPC) IsBufferEmpty ¶
func (g *IManagerPluginRPC) IsBufferEmpty() bool
func (*IManagerPluginRPC) RetrieveDBStateByHeight ¶
func (g *IManagerPluginRPC) RetrieveDBStateByHeight(height uint32) error
func (*IManagerPluginRPC) SetSigningKey ¶
func (g *IManagerPluginRPC) SetSigningKey(sec []byte) error
func (*IManagerPluginRPC) UploadDBStateBytes ¶
func (g *IManagerPluginRPC) UploadDBStateBytes(data []byte, sign bool) error
func (*IManagerPluginRPC) UploadIfOnDisk ¶
func (g *IManagerPluginRPC) UploadIfOnDisk(height uint32) bool
type IManagerPluginRPCServer ¶
type IManagerPluginRPCServer struct { // This is the real implementation Impl interfaces.IManagerController }
Here is the RPC server that IManagerPluginRPC talks to, conforming to the requirements of net/rpc
func (*IManagerPluginRPCServer) Alive ¶
func (s *IManagerPluginRPCServer) Alive(args interface{}, resp *error) error
func (*IManagerPluginRPCServer) CompletedHeightTo ¶
func (s *IManagerPluginRPCServer) CompletedHeightTo(height uint32, resp *error) error
func (*IManagerPluginRPCServer) FetchFromBuffer ¶
func (s *IManagerPluginRPCServer) FetchFromBuffer(args interface{}, resp *[]byte) error
func (*IManagerPluginRPCServer) IsBufferEmpty ¶
func (s *IManagerPluginRPCServer) IsBufferEmpty(args interface{}, resp *bool) error
func (*IManagerPluginRPCServer) RetrieveDBStateByHeight ¶
func (s *IManagerPluginRPCServer) RetrieveDBStateByHeight(height uint32, resp *error) error
func (*IManagerPluginRPCServer) SetSigningKey ¶
func (s *IManagerPluginRPCServer) SetSigningKey(key []byte, resp *error) error
func (*IManagerPluginRPCServer) UploadDBStateBytes ¶
func (s *IManagerPluginRPCServer) UploadDBStateBytes(args *UploadDBStateArgs, resp *error) error
func (*IManagerPluginRPCServer) UploadIfOnDisk ¶
func (s *IManagerPluginRPCServer) UploadIfOnDisk(height uint32, resp *bool) error
type LoadGenerator ¶
type LoadGenerator struct { ECKey *primitives.PrivateKey // Entry Credit private key ToSend int // How much to send PerSecond atomic.AtomicInt // How much per second // contains filtered or unexported fields }
func NewLoadGenerator ¶
func NewLoadGenerator(s *state.State) *LoadGenerator
NewLoadGenerator makes a new load generator. The state is used for funding the transaction
func (*LoadGenerator) KeepUsFunded ¶
func (lg *LoadGenerator) KeepUsFunded()
func (*LoadGenerator) NewCommitChain ¶
func (lg *LoadGenerator) NewCommitChain(entry *entryBlock.Entry) *messages.CommitChainMsg
func (*LoadGenerator) NewCommitEntry ¶
func (lg *LoadGenerator) NewCommitEntry(entry *entryBlock.Entry) *messages.CommitEntryMsg
func (*LoadGenerator) NewRevealEntry ¶
func (lg *LoadGenerator) NewRevealEntry(entry *entryBlock.Entry) *messages.RevealEntryMsg
func (*LoadGenerator) Run ¶
func (lg *LoadGenerator) Run()
func (*LoadGenerator) Stop ¶
func (lg *LoadGenerator) Stop()
type MsgLog ¶
type MsgLog struct { Enable bool MsgList []*msglist Last interfaces.Timestamp // The last period (msg rate over the last period, so msg changes can be seen) Period int64 Startp interfaces.Timestamp MsgCntp int MsgPerSecp int // contains filtered or unexported fields }
func (*MsgLog) Add2 ¶
func (m *MsgLog) Add2(fnode *FactomNode, out bool, peer string, where string, valid bool, msg interfaces.IMsg)
func (*MsgLog) PrtMsgs ¶
func (m *MsgLog) PrtMsgs(state interfaces.IState)
type P2PProxy ¶
type P2PProxy struct { // A connection to this node: ToName string FromName string // Channels that define the connection: BroadcastOut chan interface{} // FactomMessage ToNetwork from factomd BroadcastIn chan interface{} // FactomMessage FromNetwork for Factomd ToNetwork chan interface{} // p2p.Parcel From p2pProxy to the p2p Controller FromNetwork chan interface{} // p2p.Parcel Parcels from the network for the application NumPeers int // contains filtered or unexported fields }
func (*P2PProxy) Equals ¶
func (f *P2PProxy) Equals(ff interfaces.IPeer) bool
Is this connection equal to parm connection
func (*P2PProxy) GetNameFrom ¶
func (*P2PProxy) ManageInChannel ¶
func (f *P2PProxy) ManageInChannel()
manageInChannel takes messages from the network and stuffs it in the f.BroadcastIn channel
func (*P2PProxy) ManageOutChannel ¶
func (f *P2PProxy) ManageOutChannel()
manageOutChannel takes messages from the f.broadcastOut channel and sends them to the network.
func (*P2PProxy) Receive ¶
func (f *P2PProxy) Receive() (interfaces.IMsg, error)
Non-blocking return value from channel.
func (*P2PProxy) StartProxy ¶
func (p *P2PProxy) StartProxy()
type SimPeer ¶
type SimPeer struct { // A connection to this node: FromName string ToName string // Channels that define the connection: BroadcastOut chan *SimPacket BroadcastIn chan *SimPacket // Delay in Milliseconds Delay int64 // The maximum delay DelayUse int64 // We actually select a random delay for each data element. // Were we hold delayed packets Delayed *SimPacket Last int64 // Last time reset (nano seconds) RateOut int // Rate of Bytes output per ms RateIn int // Rate of Bytes input per ms // contains filtered or unexported fields }
func (*SimPeer) GetNameFrom ¶
type UploadDBStateArgs ¶
Source Files ¶
- MsgLogging.go
- NetStart.go
- NetworkProcessorNet.go
- Signal.go
- SimPeer.go
- factomParams.go
- factomd.go
- faulttest.go
- instrumentation.go
- loadJournal.go
- loadcreate.go
- p2pProxy.go
- pluginImpl.go
- pluginMap.go
- printElections.go
- printSummary.go
- profiler.go
- simAuthorities.go
- simControl.go
- simWallet.go
- timer.go
- version.go