本文整理匯總了Golang中github.com/FactomProject/factomd/state.State.Journaling方法的典型用法代碼示例。如果您正苦於以下問題:Golang State.Journaling方法的具體用法?Golang State.Journaling怎麽用?Golang State.Journaling使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/FactomProject/factomd/state.State
的用法示例。
在下文中一共展示了State.Journaling方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: NetStart
func NetStart(s *state.State) {
enablenetPtr := flag.Bool("enablenet", true, "Enable or disable networking")
listenToPtr := flag.Int("node", 0, "Node Number the simulator will set as the focus")
cntPtr := flag.Int("count", 1, "The number of nodes to generate")
netPtr := flag.String("net", "tree", "The default algorithm to build the network connections")
fnetPtr := flag.String("fnet", "", "Read the given file to build the network connections")
dropPtr := flag.Int("drop", 0, "Number of messages to drop out of every thousand")
journalPtr := flag.String("journal", "", "Rerun a Journal of messages")
journalingPtr := flag.Bool("journaling", false, "Write a journal of all messages recieved. Default is off.")
followerPtr := flag.Bool("follower", false, "If true, force node to be a follower. Only used when replaying a journal.")
leaderPtr := flag.Bool("leader", true, "If true, force node to be a leader. Only used when replaying a journal.")
dbPtr := flag.String("db", "", "Override the Database in the Config file and use this Database implementation")
cloneDBPtr := flag.String("clonedb", "", "Override the main node and use this database for the clones in a Network.")
portOverridePtr := flag.Int("port", 0, "Address to serve WSAPI on")
networkNamePtr := flag.String("network", "", "Network to join: MAIN, TEST or LOCAL")
networkPortOverridePtr := flag.Int("networkPort", 0, "Address for p2p network to listen on.")
peersPtr := flag.String("peers", "", "Array of peer addresses. ")
blkTimePtr := flag.Int("blktime", 0, "Seconds per block. Production is 600.")
runtimeLogPtr := flag.Bool("runtimeLog", false, "If true, maintain runtime logs of messages passed.")
netdebugPtr := flag.Int("netdebug", 0, "0-5: 0 = quiet, >0 = increasing levels of logging")
exclusivePtr := flag.Bool("exclusive", false, "If true, we only dial out to special/trusted peers.")
prefixNodePtr := flag.String("prefix", "", "Prefix the Factom Node Names with this value; used to create leaderless networks.")
rotatePtr := flag.Bool("rotate", false, "If true, responsiblity is owned by one leader, and rotated over the leaders.")
timeOffsetPtr := flag.Int("timedelta", 0, "Maximum timeDelta in milliseconds to offset each node. Simulates deltas in system clocks over a network.")
keepMismatchPtr := flag.Bool("keepmismatch", false, "If true, do not discard DBStates even when a majority of DBSignatures have a different hash")
startDelayPtr := flag.Int("startdelay", 10, "Delay to start processing messages, in seconds")
deadlinePtr := flag.Int("deadline", 1000, "Timeout Delay in milliseconds used on Reads and Writes to the network comm")
customNetPtr := flag.String("customnet", "", "This string specifies a custom blockchain network ID.")
rpcUserflag := flag.String("rpcuser", "", "Username to protect factomd local API with simple HTTP authentication")
rpcPasswordflag := flag.String("rpcpass", "", "Password to protect factomd local API. Ignored if rpcuser is blank")
factomdTLSflag := flag.Bool("tls", false, "Set to true to require encrypted connections to factomd API and Control Panel") //to get tls, run as "factomd -tls=true"
factomdLocationsflag := flag.String("selfaddr", "", "comma seperated IPAddresses and DNS names of this factomd to use when creating a cert file")
flag.Parse()
enableNet := *enablenetPtr
listenTo := *listenToPtr
cnt := *cntPtr
net := *netPtr
fnet := *fnetPtr
droprate := *dropPtr
journal := *journalPtr
journaling := *journalingPtr
follower := *followerPtr
leader := *leaderPtr
db := *dbPtr
cloneDB := *cloneDBPtr
portOverride := *portOverridePtr
peers := *peersPtr
networkName := *networkNamePtr
networkPortOverride := *networkPortOverridePtr
blkTime := *blkTimePtr
runtimeLog := *runtimeLogPtr
netdebug := *netdebugPtr
exclusive := *exclusivePtr
prefix := *prefixNodePtr
rotate := *rotatePtr
timeOffset := *timeOffsetPtr
keepMismatch := *keepMismatchPtr
startDelay := int64(*startDelayPtr)
deadline := *deadlinePtr
customNet := primitives.Sha([]byte(*customNetPtr)).Bytes()[:4]
rpcUser := *rpcUserflag
rpcPassword := *rpcPasswordflag
factomdTLS := *factomdTLSflag
factomdLocations := *factomdLocationsflag
// Must add the prefix before loading the configuration.
s.AddPrefix(prefix)
FactomConfigFilename := util.GetConfigFilename("m2")
fmt.Println(fmt.Sprintf("factom config: %s", FactomConfigFilename))
s.LoadConfig(FactomConfigFilename, networkName)
s.OneLeader = rotate
s.TimeOffset = primitives.NewTimestampFromMilliseconds(uint64(timeOffset))
s.StartDelayLimit = startDelay * 1000
s.Journaling = journaling
if 999 < portOverride { // The command line flag exists and seems reasonable.
s.SetPort(portOverride)
}
if blkTime != 0 {
s.DirectoryBlockInSeconds = blkTime
} else {
blkTime = s.DirectoryBlockInSeconds
}
if follower {
leader = false
}
if leader {
follower = false
}
if !follower && !leader {
panic("Not a leader or a follower")
}
if journal != "" {
cnt = 1
}
//.........這裏部分代碼省略.........