_id
stringlengths
2
7
text
stringlengths
6
2.61k
title
stringclasses
1 value
c175300
// NewLogCache is used to create a new LogCache with the // given capacity and backend store.
c175301
// Connect is used to connect this transport to another transport for // a given peer name. This allows for local routing.
c175302
// Disconnect is used to remove the ability to route to a given peer.
c175303
// DisconnectAll is used to remove all routes to peers.
c175304
// Respond is used to respond with a response, error or both
c175305
// Open is a function you can call to access the underlying snapshot and its // metadata.
c175306
// vote is used to respond to a verifyFuture. // This may block when responding on the notifyCh.
c175307
// notifyAll is used to notify all the waiting verify futures // if the follower believes we are still the leader.
c175308
// cleanNotify is used to delete notify, .
c175309
// LastContact returns the time of last contact.
c175310
// setLastContact sets the last contact to the current time.
c175311
// replicate is a long running routine that replicates log entries to a single // follower.
c175312
// pipelineReplicate is used when we have synchronized our state with the follower, // and want to switch to a higher performance pipeline mode of replication. // We only pipeline AppendEntries commands, and if we ever hit an error, we fall // back to the standard replication which can handle more complex situations.
c175313
// pipelineSend is used to send data over a pipeline. It is a helper to // pipelineReplicate.
c175314
// pipelineDecode is used to decode the responses of pipelined requests.
c175315
// setupAppendEntries is used to setup an append entries request.
c175316
// setPreviousLog is used to setup the PrevLogEntry and PrevLogTerm for an // AppendEntriesRequest given the next index to replicate.
c175317
// setNewLogs is used to setup the logs which should be appended for a request.
c175318
// appendStats is used to emit stats about an AppendEntries invocation.
c175319
// handleStaleTerm is used when a follower indicates that we have a stale term.
c175320
// AppendEntries sends the appropriate RPC to the target node.
c175321
// RequestVote sends the appropriate RPC to the target node.
c175322
// InstallSnapshot is used to push a snapshot down to a follower. The data is read from // the ReadCloser and streamed to the client.
c175323
// EncodePeer is used to serialize a peer name.
c175324
// DecodePeer is used to deserialize a peer name.
c175325
// AppendEntries is used to add another request to the pipeline. // The send may block which is an effective form of back-pressure.
c175326
// ReadPeersJSON consumes a legacy peers.json file in the format of the old JSON // peer store and creates a new-style configuration structure. This can be used // to migrate this data or perform manual recovery when running protocol versions // that can interoperate with older, unversioned Raft servers. This should no...
c175327
// ReadConfigJSON reads a new-style peers.json and returns a configuration // structure. This can be used to perform manual recovery when running protocol // versions that use server IDs.
c175328
// NewTCPTransport returns a NetworkTransport that is built on top of // a TCP streaming transport layer.
c175329
// NewTCPTransportWithLogger returns a NetworkTransport that is built on top of // a TCP streaming transport layer, with log output going to the supplied Logger
c175330
// NewTCPTransportWithConfig returns a NetworkTransport that is built on top of // a TCP streaming transport layer, using the given config struct.
c175331
// Accept implements the net.Listener interface.
c175332
// Addr implements the net.Listener interface.
c175333
// restoreSnapshot attempts to restore the latest snapshots, and fails if none // of them can be restored. This is called at initialization time, and is // completely unsafe to call at any other time.
c175334
// BootstrapCluster is equivalent to non-member BootstrapCluster but can be // called on an un-bootstrapped Raft instance after it has been created. This // should only be called at the beginning of time for the cluster, and you // absolutely must make sure that you call it with the same configuration on all // the Vot...
c175335
// Leader is used to return the current leader of the cluster. // It may return empty string if there is no current leader // or the leader is unknown.
c175336
// Apply is used to apply a command to the FSM in a highly consistent // manner. This returns a future that can be used to wait on the application. // An optional timeout can be provided to limit the amount of time we wait // for the command to be started. This must be run on the leader or it // will fail.
c175337
// Barrier is used to issue a command that blocks until all preceeding // operations have been applied to the FSM. It can be used to ensure the // FSM reflects all queued writes. An optional timeout can be provided to // limit the amount of time we wait for the command to be started. This // must be run on the leader o...
c175338
// VerifyLeader is used to ensure the current node is still // the leader. This can be done to prevent stale reads when a // new leader has potentially been elected.
c175339
// AddVoter will add the given server to the cluster as a staging server. If the // server is already in the cluster as a voter, this updates the server's address. // This must be run on the leader or it will fail. The leader will promote the // staging server to a voter once that server is ready. If nonzero, prevIndex...
c175340
// RemoveServer will remove the given server from the cluster. If the current // leader is being removed, it will cause a new election to occur. This must be // run on the leader or it will fail. For prevIndex and timeout, see AddVoter.
c175341
// Shutdown is used to stop the Raft background routines. // This is not a graceful operation. Provides a future that // can be used to block until all background routines have exited.
c175342
// Snapshot is used to manually force Raft to take a snapshot. Returns a future // that can be used to block until complete, and that contains a function that // can be used to open the snapshot.
c175343
// Restore is used to manually force Raft to consume an external snapshot, such // as if restoring from a backup. We will use the current Raft configuration, // not the one from the snapshot, so that we can restore into a new cluster. We // will also use the higher of the index of the snapshot, or the current index, //...
c175344
// String returns a string representation of this Raft node.
c175345
// LastContact returns the time of last contact by a leader. // This only makes sense if we are currently a follower.
c175346
// Logf will record a formatted message to the contained debug log
c175347
// containsNode returns true if the slice 'nodes' contains 'n'
c175348
// LeaderPlus returns the leader + n additional nodes from the cluster // the leader is always the first node in the returned slice.
c175349
// WaitTilUptoDate blocks until all nodes in the cluster have gotten their // commitedIndex upto the Index from the last successful call to Apply
c175350
// assertLogEntryEqual compares the 2 raft Log entries and reports any differences to the supplied testing.T instance // it return true if the 2 entries are equal, false otherwise.
c175351
// runFSM is a long running goroutine responsible for applying logs // to the FSM. This is done async of other logs since we don't want // the FSM to block our internal operations.
c175352
// Clone makes a deep copy of a Configuration.
c175353
// Clone makes a deep copy of a configurations object.
c175354
// hasVote returns true if the server identified by 'id' is a Voter in the // provided Configuration.
c175355
// checkConfiguration tests a cluster membership configuration for common // errors.
c175356
// nextConfiguration generates a new Configuration from the current one and a // configuration change request. It's split from appendConfigurationEntry so // that it can be unit tested easily.
c175357
// encodePeers is used to serialize a Configuration into the old peers format. // This is here for backwards compatibility when operating with a mix of old // servers and should be removed once we deprecate support for protocol version 1.
c175358
// decodePeers is used to deserialize an old list of peers into a Configuration. // This is here for backwards compatibility with old log entries and snapshots; // it should be removed eventually.
c175359
// encodeConfiguration serializes a Configuration using MsgPack, or panics on // errors.
c175360
// decodeConfiguration deserializes a Configuration using MsgPack, or panics on // errors.
c175361
// Start a goroutine and properly handle the race between a routine // starting and incrementing, and exiting and decrementing.
c175362
// getLastIndex returns the last index in stable storage. // Either from the last log or from the last snapshot.
c175363
// getLastEntry returns the last index and term in stable storage. // Either from the last log or from the last snapshot.
c175364
// checkRPCHeader houses logic about whether this instance of Raft can process // the given RPC message.
c175365
// setLeader is used to modify the current leader of the cluster
c175366
// requestConfigChange is a helper for the above functions that make // configuration change requests. 'req' describes the change. For timeout, // see AddVoter.
c175367
// run is a long running goroutine that runs the Raft FSM.
c175368
// runFollower runs the FSM for a follower.
c175369
// liveBootstrap attempts to seed an initial configuration for the cluster. See // the Raft object's member BootstrapCluster for more details. This must only be // called on the main thread, and only makes sense in the follower state.
c175370
// runCandidate runs the FSM for a candidate.
c175371
// runLeader runs the FSM for a leader. Do the setup here and drop into // the leaderLoop for the hot loop.
c175372
// startStopReplication will set up state and start asynchronous replication to // new peers, and stop replication to removed peers. Before removing a peer, // it'll instruct the replication routines to try to replicate to the current // index. This must only be called from the main thread.
c175373
// configurationChangeChIfStable returns r.configurationChangeCh if it's safe // to process requests from it, or nil otherwise. This must only be called // from the main thread. // // Note that if the conditions here were to change outside of leaderLoop to take // this from nil to non-nil, we would need leaderLoop to b...
c175374
// verifyLeader must be called from the main thread for safety. // Causes the followers to attempt an immediate heartbeat.
c175375
// checkLeaderLease is used to check if we can contact a quorum of nodes // within the last leader lease interval. If not, we need to step down, // as we may have lost connectivity. Returns the maximum duration without // contact. This must only be called from the main thread.
c175376
// restoreUserSnapshot is used to manually consume an external snapshot, such // as if restoring from a backup. We will use the current Raft configuration, // not the one from the snapshot, so that we can restore into a new cluster. We // will also use the higher of the index of the snapshot, or the current index, // a...
c175377
// appendConfigurationEntry changes the configuration and adds a new // configuration entry to the log. This must only be called from the // main thread.
c175378
// dispatchLog is called on the leader to push a log to disk, mark it // as inflight and begin replication of it.
c175379
// processLogs is used to apply all the committed entries that haven't been // applied up to the given index limit. // This can be called from both leaders and followers. // Followers call this from AppendEntries, for n entries at a time, and always // pass future=nil. // Leaders call this once per inflight when entrie...
c175380
// processLog is invoked to process the application of a single committed log entry.
c175381
// processRPC is called to handle an incoming RPC request. This must only be // called from the main thread.
c175382
// processHeartbeat is a special handler used just for heartbeat requests // so that they can be fast-pathed if a transport supports it. This must only // be called from the main thread.
c175383
// setLastContact is used to set the last contact time to now
c175384
// persistVote is used to persist our vote for safety.
c175385
// setCurrentTerm is used to set the current term in a durable manner.
c175386
// setState is used to update the current state. Any state // transition causes the known leader to be cleared. This means // that leader should be set only after updating the state.
c175387
// Called by leader after commitCh is notified
c175388
// Internal helper to calculate new commitIndex from matchIndexes. // Must be called with lock held.
c175389
// randomTimeout returns a value that is between the minVal and 2x minVal.
c175390
// generateUUID is used to generate a random UUID.
c175391
// Decode reverses the encode operation on a byte slice input.
c175392
// Encode writes an encoded object to a new bytes buffer.
c175393
// backoff is used to compute an exponential backoff // duration. Base time is scaled by the current round, // up to some maximum scale factor.
c175394
// newApplySource will create a new source, any source created with the same seed will generate the same sequence of data.
c175395
// reset this source back to its initial state, it'll generate the same sequence of data it initially did
c175396
// DefaultConfig returns a Config with usable defaults.
c175397
// ValidateConfig is used to validate a sane configuration
c175398
// runSnapshots is a long running goroutine used to manage taking // new snapshots of the FSM. It runs in parallel to the FSM and // main goroutines, so that snapshots do not block normal operation.
c175399
// shouldSnapshot checks if we meet the conditions to take // a new snapshot.