_id
stringlengths
2
7
title
stringclasses
1 value
partition
stringclasses
3 values
text
stringlengths
6
2.61k
language
stringclasses
1 value
meta_information
dict
c26700
train
// Looks up, or create a new channel if it does not exist
{ "resource": "" }
c26701
train
// createSubStore creates a new instance of `subStore`.
{ "resource": "" }
c26702
train
// Store adds this subscription to the server's `subStore` and also in storage
{ "resource": "" }
c26703
train
// hasSubs returns true if there is any active subscription for this subStore. // That is, offline durable subscriptions are ignored.
{ "resource": "" }
c26704
train
// Lookup by durable name.
{ "resource": "" }
c26705
train
// Lookup by ackInbox name.
{ "resource": "" }
c26706
train
// Clone returns a deep copy of the Options object.
{ "resource": "" }
c26707
train
// GetDefaultOptions returns default options for the NATS Streaming Server
{ "resource": "" }
c26708
train
// RunServer will startup an embedded NATS Streaming Server and a nats-server to support it.
{ "resource": "" }
c26709
train
// startRaftNode creates and starts the Raft group. // This should only be called if the server is running in clustered mode.
{ "resource": "" }
c26710
train
// leadershipAcquired should be called when this node is elected leader. // This should only be called when the server is running in clustered mode.
{ "resource": "" }
c26711
train
// leadershipLost should be called when this node loses leadership. // This should only be called when the server is running in clustered mode.
{ "resource": "" }
c26712
train
// ensureRunningStandAlone prevents this streaming server from starting // if another is found using the same cluster ID - a possibility when // routing is enabled. // This runs under sever's lock so nothing should grab the server lock here.
{ "resource": "" }
c26713
train
// Binds server's view of a client with stored Client objects.
{ "resource": "" }
c26714
train
// Reconstruct the subscription state on restart.
{ "resource": "" }
c26715
train
// Redelivers unacknowledged messages, releases the hold for new messages delivery, // and kicks delivery of available messages.
{ "resource": "" }
c26716
train
// initSubscriptions will setup initial subscriptions for discovery etc.
{ "resource": "" }
c26717
train
// Process a client connect request
{ "resource": "" }
c26718
train
// isDuplicateConnect determines if the given client ID is a duplicate // connection by pinging the old client's heartbeat inbox and checking if it // responds. If it does, it's a duplicate connection.
{ "resource": "" }
c26719
train
// Leader invokes this to replicate the command to delete a channel.
{ "resource": "" }
c26720
train
// Check if the channel can be deleted. If so, do it in place. // This is called from the ioLoop by the leader or a standlone server.
{ "resource": "" }
c26721
train
// Actual deletetion of the channel.
{ "resource": "" }
c26722
train
// Send a heartbeat call to the client.
{ "resource": "" }
c26723
train
// Close a client
{ "resource": "" }
c26724
train
// processCloseRequest will process connection close requests from clients.
{ "resource": "" }
c26725
train
// processClientPublish process inbound messages from clients.
{ "resource": "" }
c26726
train
// processClientPings receives a PING from a client. The payload is the client's UID. // If the client is present, a response with nil payload is sent back to indicate // success, otherwise the payload contains an error message.
{ "resource": "" }
c26727
train
// Send a message to the queue group // Assumes qs lock held for write
{ "resource": "" }
c26728
train
// processMsg will process a message, and possibly send to clients, etc.
{ "resource": "" }
c26729
train
// Returns an array of message sequence numbers ordered by sequence.
{ "resource": "" }
c26730
train
// Redeliver all outstanding messages to a durable subscriber, used on resubscribe.
{ "resource": "" }
c26731
train
// Keep track of sent or ack messages. // If the number of operations reach a certain threshold, // the sub is added to list of subs that should be flushed asap. // This call does not do actual RAFT replication and should not block. // Caller holds the sub's Lock.
{ "resource": "" }
c26732
train
// Replicates through RAFT
{ "resource": "" }
c26733
train
// Little helper function to create a RaftOperation_SendAndAck protocol // and serialize it.
{ "resource": "" }
c26734
train
// Sub lock is held on entry
{ "resource": "" }
c26735
train
// Sends the message to the subscriber // Unless `force` is true, in which case message is always sent, if the number // of acksPending is greater or equal to the sub's MaxInFlight limit, messages // are not sent and subscriber is marked as stalled. // Sub lock should be held before calling.
{ "resource": "" }
c26736
train
// Sets up the ackTimer to fire at the given duration. // sub's lock held on entry.
{ "resource": "" }
c26737
train
// Sends a special ioPendingMsg to indicate that we should attempt // to delete the given channel.
{ "resource": "" }
c26738
train
// ackPublisher sends the ack for a message.
{ "resource": "" }
c26739
train
// Delete a sub from a given list.
{ "resource": "" }
c26740
train
// Checks if we need to do a resize. This is for very large growth then // subsequent return to a more normal size.
{ "resource": "" }
c26741
train
// removeAllNonDurableSubscribers will remove all non-durable subscribers for the client.
{ "resource": "" }
c26742
train
// processUnsubscribeRequest will process a unsubscribe request.
{ "resource": "" }
c26743
train
// performmUnsubOrCloseSubscription processes the unsub or close subscription // request.
{ "resource": "" }
c26744
train
// Clear the ackTimer. // sub Lock held in entry.
{ "resource": "" }
c26745
train
// adjustAckTimer adjusts the timer based on a given next // expiration time. // The timer will be stopped if there is no more pending ack. // If there are pending acks, the timer will be reset to the // default sub.ackWait value if the given expiration time is // 0 or in the past. Otherwise, it is set to the remaining...
{ "resource": "" }
c26746
train
// Subscribes to the AckInbox subject in order to process subscription's acks // if not already done. // This function grabs and releases the sub's lock.
{ "resource": "" }
c26747
train
// Stops subscribing to AckInbox. // Lock assumed held on entry.
{ "resource": "" }
c26748
train
// Returns true if this is a "shadow" durable queue subscriber
{ "resource": "" }
c26749
train
// replicateSub replicates the SubscriptionRequest to nodes in the cluster via // Raft.
{ "resource": "" }
c26750
train
// addSubscription adds `sub` to the client and store.
{ "resource": "" }
c26751
train
// updateDurable adds back `sub` to the client and updates the store. // No lock is needed for `sub` since it has just been created.
{ "resource": "" }
c26752
train
// processAckMsg processes inbound acks from clients for delivered messages.
{ "resource": "" }
c26753
train
// processAck processes an ack and if needed sends more messages.
{ "resource": "" }
c26754
train
// Send any messages that are ready to be sent that have been queued to the group.
{ "resource": "" }
c26755
train
// Send any messages that are ready to be sent that have been queued.
{ "resource": "" }
c26756
train
// Setup the start position for the subscriber.
{ "resource": "" }
c26757
train
// startGoRoutine starts the given function as a go routine if and only if // the server was not shutdown at that time. This is required because // we cannot increment the wait group after the shutdown process has started.
{ "resource": "" }
c26758
train
// ClusterID returns the NATS Streaming Server's ID.
{ "resource": "" }
c26759
train
// State returns the state of this server.
{ "resource": "" }
c26760
train
// setLastError sets the last fatal error that occurred. This is // used in case of an async error that cannot directly be reported // to the user.
{ "resource": "" }
c26761
train
// LastError returns the last fatal error the server experienced.
{ "resource": "" }
c26762
train
// Shutdown will close our NATS connection and shutdown any embedded NATS server.
{ "resource": "" }
c26763
train
// SetLogger sets the logger, debug and trace
{ "resource": "" }
c26764
train
// GetLogger returns the logger
{ "resource": "" }
c26765
train
// ReopenLogFile closes and reopen the logfile. // Does nothing if the logger is not a file based.
{ "resource": "" }
c26766
train
// Close closes this logger, releasing possible held resources.
{ "resource": "" }
c26767
train
// Errorf logs an error
{ "resource": "" }
c26768
train
// Warnf logs a warning statement
{ "resource": "" }
c26769
train
// BufferSize is a FileStore option that sets the size of the buffer used // during store writes. This can help improve write performance.
{ "resource": "" }
c26770
train
// CompactEnabled is a FileStore option that enables or disables file compaction. // The value false will disable compaction.
{ "resource": "" }
c26771
train
// CompactInterval is a FileStore option that defines the minimum compaction interval. // Compaction is not timer based, but instead when things get "deleted". This value // prevents compaction to happen too often.
{ "resource": "" }
c26772
train
// CompactFragmentation is a FileStore option that defines the fragmentation ratio // below which compaction would not occur. For instance, specifying 50 means that // if other variables would allow for compaction, the compaction would occur only // after 50% of the file has data that is no longer valid.
{ "resource": "" }
c26773
train
// CompactMinFileSize is a FileStore option that defines the minimum file size below // which compaction would not occur. Specify `0` if you don't want any minimum.
{ "resource": "" }
c26774
train
// DoCRC is a FileStore option that defines if a CRC checksum verification should // be performed when records are read from disk.
{ "resource": "" }
c26775
train
// SliceConfig is a FileStore option that allows the configuration of // file slice limits and optional archive script file name.
{ "resource": "" }
c26776
train
// FileDescriptorsLimit is a soft limit hinting at FileStore to try to // limit the number of concurrent opened files to that limit.
{ "resource": "" }
c26777
train
// ParallelRecovery is a FileStore option that allows the parallel // recovery of channels. When running with SSDs, try to use a higher // value than the default number of 1. When running with HDDs, // performance may be better if it stays at 1.
{ "resource": "" }
c26778
train
// AllOptions is a convenient option to pass all options from a FileStoreOptions // structure to the constructor.
{ "resource": "" }
c26779
train
// check that the version of the file is understood by this interface
{ "resource": "" }
c26780
train
// createNewWriter creates a new buffer writer for `file` with // the bufferedWriter's current buffer size.
{ "resource": "" }
c26781
train
// tryShrinkBuffer checks and possibly shrinks the buffer
{ "resource": "" }
c26782
train
// checkShrinkRequest checks how full the buffer is, and if is above a certain // threshold, cancels the shrink request
{ "resource": "" }
c26783
train
// openFile opens the given file and sets its state to `fileInUse`. // If the file manager has been closed or the file removed, this call // returns an error. // Otherwise, if the file's state is not `fileClosed` this call will panic. // This call will possibly cause opened but unused files to be closed if the // numbe...
{ "resource": "" }
c26784
train
// closeLockedFile closes the handle of the given file, but only if the caller // has locked the file. Will panic otherwise. // If the file's beforeClose callback is not nil, this callback is invoked // before the file handle is closed.
{ "resource": "" }
c26785
train
// closeFileIfOpened closes the handle of the given file, but only if the // file is opened and not currently locked. Does not return any error or panic // if file is in any other state. // If the file's beforeClose callback is not nil, this callback is invoked // before the file handle is closed.
{ "resource": "" }
c26786
train
// doClose closes the file handle, setting it to nil and switching state to `fileClosed`. // If a `beforeClose` callback was registered on file creation, it is invoked // before the file handler is actually closed. // Lock is required on entry.
{ "resource": "" }
c26787
train
// lockFile locks the given file. // If the file was already opened, the boolean returned is true, // otherwise, the file is opened and the call returns false.
{ "resource": "" }
c26788
train
// unlockFile unlocks the file if currently locked, otherwise panic.
{ "resource": "" }
c26789
train
// trySwitchState attempts to switch an initial state of `fileOpened` // or `fileClosed` to the given newState. If it can't it will return an // error, otherwise, returned a boolean to indicate if the initial state // was `fileOpened`.
{ "resource": "" }
c26790
train
// close the files manager, including all files currently opened. // Returns the first error encountered when closing the files.
{ "resource": "" }
c26791
train
// Init is used to persist server's information after the first start
{ "resource": "" }
c26792
train
// recoverClients reads the client files and returns an array of RecoveredClient
{ "resource": "" }
c26793
train
// recoverServerInfo reads the server file and returns a ServerInfo structure
{ "resource": "" }
c26794
train
// shouldCompactClientFile returns true if the client file should be compacted // Lock is held by caller
{ "resource": "" }
c26795
train
// Rewrite the content of the clients map into a temporary file, // then swap back to active file. // Store lock held on entry
{ "resource": "" }
c26796
train
// Close closes all stores.
{ "resource": "" }
c26797
train
// beforeDataFileCloseCb returns a beforeFileClose callback to be used // by FileMsgStore's files when a data file for that slice is being closed. // This is invoked asynchronously and should not acquire the store's lock. // That being said, we have the guarantee that this will be not be invoked // concurrently for a g...
{ "resource": "" }
c26798
train
// beforeIndexFileCloseCb returns a beforeFileClose callback to be used // by FileMsgStore's files when an index file for that slice is being closed. // This is invoked asynchronously and should not acquire the store's lock. // That being said, we have the guarantee that this will be not be invoked // concurrently for ...
{ "resource": "" }
c26799
train
// setFile sets the current data and index file. // The buffered writer is recreated.
{ "resource": "" }