_id
stringlengths
2
7
title
stringclasses
1 value
partition
stringclasses
3 values
text
stringlengths
6
2.61k
language
stringclasses
1 value
meta_information
dict
c175300
test
// NewLogCache is used to create a new LogCache with the // given capacity and backend store.
{ "resource": "" }
c175301
test
// Connect is used to connect this transport to another transport for // a given peer name. This allows for local routing.
{ "resource": "" }
c175302
test
// Disconnect is used to remove the ability to route to a given peer.
{ "resource": "" }
c175303
test
// DisconnectAll is used to remove all routes to peers.
{ "resource": "" }
c175304
test
// Respond is used to respond with a response, error or both
{ "resource": "" }
c175305
test
// Open is a function you can call to access the underlying snapshot and its // metadata.
{ "resource": "" }
c175306
test
// vote is used to respond to a verifyFuture. // This may block when responding on the notifyCh.
{ "resource": "" }
c175307
test
// notifyAll is used to notify all the waiting verify futures // if the follower believes we are still the leader.
{ "resource": "" }
c175308
test
// cleanNotify is used to delete notify, .
{ "resource": "" }
c175309
test
// LastContact returns the time of last contact.
{ "resource": "" }
c175310
test
// setLastContact sets the last contact to the current time.
{ "resource": "" }
c175311
test
// replicate is a long running routine that replicates log entries to a single // follower.
{ "resource": "" }
c175312
test
// 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.
{ "resource": "" }
c175313
test
// pipelineSend is used to send data over a pipeline. It is a helper to // pipelineReplicate.
{ "resource": "" }
c175314
test
// pipelineDecode is used to decode the responses of pipelined requests.
{ "resource": "" }
c175315
test
// setupAppendEntries is used to setup an append entries request.
{ "resource": "" }
c175316
test
// setPreviousLog is used to setup the PrevLogEntry and PrevLogTerm for an // AppendEntriesRequest given the next index to replicate.
{ "resource": "" }
c175317
test
// setNewLogs is used to setup the logs which should be appended for a request.
{ "resource": "" }
c175318
test
// appendStats is used to emit stats about an AppendEntries invocation.
{ "resource": "" }
c175319
test
// handleStaleTerm is used when a follower indicates that we have a stale term.
{ "resource": "" }
c175320
test
// AppendEntries sends the appropriate RPC to the target node.
{ "resource": "" }
c175321
test
// RequestVote sends the appropriate RPC to the target node.
{ "resource": "" }
c175322
test
// InstallSnapshot is used to push a snapshot down to a follower. The data is read from // the ReadCloser and streamed to the client.
{ "resource": "" }
c175323
test
// EncodePeer is used to serialize a peer name.
{ "resource": "" }
c175324
test
// DecodePeer is used to deserialize a peer name.
{ "resource": "" }
c175325
test
// AppendEntries is used to add another request to the pipeline. // The send may block which is an effective form of back-pressure.
{ "resource": "" }
c175326
test
// 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...
{ "resource": "" }
c175327
test
// 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.
{ "resource": "" }
c175328
test
// NewTCPTransport returns a NetworkTransport that is built on top of // a TCP streaming transport layer.
{ "resource": "" }
c175329
test
// NewTCPTransportWithLogger returns a NetworkTransport that is built on top of // a TCP streaming transport layer, with log output going to the supplied Logger
{ "resource": "" }
c175330
test
// NewTCPTransportWithConfig returns a NetworkTransport that is built on top of // a TCP streaming transport layer, using the given config struct.
{ "resource": "" }
c175331
test
// Accept implements the net.Listener interface.
{ "resource": "" }
c175332
test
// Addr implements the net.Listener interface.
{ "resource": "" }
c175333
test
// 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.
{ "resource": "" }
c175334
test
// 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...
{ "resource": "" }
c175335
test
// 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.
{ "resource": "" }
c175336
test
// 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.
{ "resource": "" }
c175337
test
// 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...
{ "resource": "" }
c175338
test
// 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.
{ "resource": "" }
c175339
test
// 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...
{ "resource": "" }
c175340
test
// 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.
{ "resource": "" }
c175341
test
// 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.
{ "resource": "" }
c175342
test
// 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.
{ "resource": "" }
c175343
test
// 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, //...
{ "resource": "" }
c175344
test
// String returns a string representation of this Raft node.
{ "resource": "" }
c175345
test
// LastContact returns the time of last contact by a leader. // This only makes sense if we are currently a follower.
{ "resource": "" }
c175346
test
// Logf will record a formatted message to the contained debug log
{ "resource": "" }
c175347
test
// containsNode returns true if the slice 'nodes' contains 'n'
{ "resource": "" }
c175348
test
// LeaderPlus returns the leader + n additional nodes from the cluster // the leader is always the first node in the returned slice.
{ "resource": "" }
c175349
test
// WaitTilUptoDate blocks until all nodes in the cluster have gotten their // commitedIndex upto the Index from the last successful call to Apply
{ "resource": "" }
c175350
test
// 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.
{ "resource": "" }
c175351
test
// 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.
{ "resource": "" }
c175352
test
// Clone makes a deep copy of a Configuration.
{ "resource": "" }
c175353
test
// Clone makes a deep copy of a configurations object.
{ "resource": "" }
c175354
test
// hasVote returns true if the server identified by 'id' is a Voter in the // provided Configuration.
{ "resource": "" }
c175355
test
// checkConfiguration tests a cluster membership configuration for common // errors.
{ "resource": "" }
c175356
test
// 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.
{ "resource": "" }
c175357
test
// 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.
{ "resource": "" }
c175358
test
// 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.
{ "resource": "" }
c175359
test
// encodeConfiguration serializes a Configuration using MsgPack, or panics on // errors.
{ "resource": "" }
c175360
test
// decodeConfiguration deserializes a Configuration using MsgPack, or panics on // errors.
{ "resource": "" }
c175361
test
// Start a goroutine and properly handle the race between a routine // starting and incrementing, and exiting and decrementing.
{ "resource": "" }
c175362
test
// getLastIndex returns the last index in stable storage. // Either from the last log or from the last snapshot.
{ "resource": "" }
c175363
test
// getLastEntry returns the last index and term in stable storage. // Either from the last log or from the last snapshot.
{ "resource": "" }
c175364
test
// checkRPCHeader houses logic about whether this instance of Raft can process // the given RPC message.
{ "resource": "" }
c175365
test
// setLeader is used to modify the current leader of the cluster
{ "resource": "" }
c175366
test
// requestConfigChange is a helper for the above functions that make // configuration change requests. 'req' describes the change. For timeout, // see AddVoter.
{ "resource": "" }
c175367
test
// run is a long running goroutine that runs the Raft FSM.
{ "resource": "" }
c175368
test
// runFollower runs the FSM for a follower.
{ "resource": "" }
c175369
test
// 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.
{ "resource": "" }
c175370
test
// runCandidate runs the FSM for a candidate.
{ "resource": "" }
c175371
test
// runLeader runs the FSM for a leader. Do the setup here and drop into // the leaderLoop for the hot loop.
{ "resource": "" }
c175372
test
// 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.
{ "resource": "" }
c175373
test
// 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...
{ "resource": "" }
c175374
test
// verifyLeader must be called from the main thread for safety. // Causes the followers to attempt an immediate heartbeat.
{ "resource": "" }
c175375
test
// 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.
{ "resource": "" }
c175376
test
// 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...
{ "resource": "" }
c175377
test
// appendConfigurationEntry changes the configuration and adds a new // configuration entry to the log. This must only be called from the // main thread.
{ "resource": "" }
c175378
test
// dispatchLog is called on the leader to push a log to disk, mark it // as inflight and begin replication of it.
{ "resource": "" }
c175379
test
// 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...
{ "resource": "" }
c175380
test
// processLog is invoked to process the application of a single committed log entry.
{ "resource": "" }
c175381
test
// processRPC is called to handle an incoming RPC request. This must only be // called from the main thread.
{ "resource": "" }
c175382
test
// 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.
{ "resource": "" }
c175383
test
// setLastContact is used to set the last contact time to now
{ "resource": "" }
c175384
test
// persistVote is used to persist our vote for safety.
{ "resource": "" }
c175385
test
// setCurrentTerm is used to set the current term in a durable manner.
{ "resource": "" }
c175386
test
// 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.
{ "resource": "" }
c175387
test
// Called by leader after commitCh is notified
{ "resource": "" }
c175388
test
// Internal helper to calculate new commitIndex from matchIndexes. // Must be called with lock held.
{ "resource": "" }
c175389
test
// randomTimeout returns a value that is between the minVal and 2x minVal.
{ "resource": "" }
c175390
test
// generateUUID is used to generate a random UUID.
{ "resource": "" }
c175391
test
// Decode reverses the encode operation on a byte slice input.
{ "resource": "" }
c175392
test
// Encode writes an encoded object to a new bytes buffer.
{ "resource": "" }
c175393
test
// backoff is used to compute an exponential backoff // duration. Base time is scaled by the current round, // up to some maximum scale factor.
{ "resource": "" }
c175394
test
// newApplySource will create a new source, any source created with the same seed will generate the same sequence of data.
{ "resource": "" }
c175395
test
// reset this source back to its initial state, it'll generate the same sequence of data it initially did
{ "resource": "" }
c175396
test
// DefaultConfig returns a Config with usable defaults.
{ "resource": "" }
c175397
test
// ValidateConfig is used to validate a sane configuration
{ "resource": "" }
c175398
test
// 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.
{ "resource": "" }
c175399
test
// shouldSnapshot checks if we meet the conditions to take // a new snapshot.
{ "resource": "" }