_id
stringlengths
2
7
text
stringlengths
6
2.61k
title
stringclasses
1 value
c175100
// Value returns the value associated with the iterator.
c175101
// Next returns the next element. If it is the same as the current key, ignore it.
c175102
// Seek brings us to element with key >= given key.
c175103
// Close implements y.Iterator
c175104
// Encode encodes Pointer into byte buffer.
c175105
// Decodes h from buf.
c175106
// Encodes e to buf. Returns number of bytes written.
c175107
// SetEntry is the equivalent of Txn.SetEntry.
c175108
// Set is equivalent of Txn.SetWithMeta.
c175109
// SetWithTTL is equivalent of Txn.SetWithTTL.
c175110
// Delete is equivalent of Txn.Delete.
c175111
// Caller to commit must hold a write lock.
c175112
// Flush must be called at the end to ensure that any pending writes get committed to Badger. Flush // returns any error stored by WriteBatch.
c175113
// Error returns any errors encountered so far. No commits would be run once an error is detected.
c175114
// getMemtables returns the current memtables and get references.
c175115
// writeRequests is called serially by only one goroutine.
c175116
// ensureRoomForWrite is always called serially.
c175117
// WriteLevel0Table flushes memtable.
c175118
// handleFlushTask must be run serially.
c175119
// flushMemtable must keep running until we send it an empty flushTask. If there // are errors during handling the flush task, we'll retry indefinitely.
c175120
// This function does a filewalk, calculates the size of vlog and sst files and stores it in // y.LSMSize and y.VlogSize.
c175121
// Size returns the size of lsm and value log files in bytes. It can be used to decide how often to // call RunValueLogGC.
c175122
// Next would return the next integer in the sequence, updating the lease by running a transaction // if needed.
c175123
// Release the leased sequence to avoid wasted integers. This should be done right // before closing the associated DB. However it is valid to use the sequence after // it was released, causing a new lease with full bandwidth.
c175124
// KeySplits can be used to get rough key ranges to divide up iteration over // the DB.
c175125
// Flatten can be used to force compactions on the LSM tree so all the tables fall on the same // level. This ensures that all the versions of keys are colocated and not split across multiple // levels, which is necessary after a restore from backup. During Flatten, live compactions are // stopped. Ideally, no writes a...
c175126
// Mmap uses the mmap system call to memory-map a file. If writable is true, // memory protection of the pages is set so that they may be written to as well.
c175127
// Madvise uses the madvise system call to give advise about the use of memory // when using a slice that is memory-mapped to a file. Set the readahead flag to // false if page references are expected in random order.
c175128
// Any deleted or invalid versions at or below ts would be discarded during // compaction to reclaim disk space in LSM tree and thence value log.
c175129
// hasConflict must be called while having a lock.
c175130
// Set adds a key-value pair to the database. // // It will return ErrReadOnlyTxn if update flag was set to false when creating the // transaction. // // The current transaction keeps a reference to the key and val byte slice // arguments. Users must not modify key and val until the end of the transaction.
c175131
// SetWithMeta adds a key-value pair to the database, along with a metadata // byte. // // This byte is stored alongside the key, and can be used as an aid to // interpret the value or store other contextual bits corresponding to the // key-value pair. // // The current transaction keeps a reference to the key and val ...
c175132
// Delete deletes a key. // // This is done by adding a delete marker for the key at commit timestamp. Any // reads happening before this timestamp would be unaffected. Any reads after // this commit would see the deletion. // // The current transaction keeps a reference to the key byte slice argument. // Users must n...
c175133
// Get looks for key and returns corresponding Item. // If key is not found, ErrKeyNotFound is returned.
c175134
// CommitWith acts like Commit, but takes a callback, which gets run via a // goroutine to avoid blocking this function. The callback is guaranteed to run, // so it is safe to increment sync.WaitGroup before calling CommitWith, and // decrementing it in the callback; to block until all callbacks are run.
c175135
// View executes a function creating and managing a read-only transaction for the user. Error // returned by the function is relayed by the View method. // If View is used with managed transactions, it would assume a read timestamp of MaxUint64.
c175136
// Update executes a function, creating and managing a read-write transaction // for the user. Error returned by the function is relayed by the Update method. // Update cannot be used with managed transactions.
c175137
// Seek brings us to the first block element that is >= input key.
c175138
// SeekToLast brings us to the last element. Valid should return true.
c175139
// parseKV would allocate a new byte slice for key and for value.
c175140
// NewIterator returns a new iterator of the Table
c175141
// seekFrom brings us to a key that is >= input key.
c175142
// seekForPrev will reset iterator and seek to <= key.
c175143
// Value follows the y.Iterator interface
c175144
// Seek follows the y.Iterator interface
c175145
// NewConcatIterator creates a new concatenated iterator
c175146
// Valid implements y.Interface
c175147
// Next advances our concat iterator.
c175148
// Close implements y.Interface.
c175149
// OpenExistingFile opens an existing file, errors if it doesn't exist.
c175150
// Copy copies a byte slice and returns the copied slice.
c175151
// KeyWithTs generates a new key by appending ts to key.
c175152
// ParseTs parses the timestamp from the key bytes.
c175153
// ParseKey parses the actual key from the key bytes.
c175154
// SameKey checks for key equality ignoring the version timestamp suffix.
c175155
// FixedDuration returns a string representation of the given duration with the // hours, minutes, and seconds.
c175156
// NewCloser constructs a new Closer, with an initial count on the WaitGroup.
c175157
// NewThrottle creates a new throttle with a max number of workers.
c175158
// Do should be called by workers before they start working. It blocks if there // are already maximum number of workers working. If it detects an error from // previously Done workers, it would return it.
c175159
// Done should be called by workers when they finish working. They can also // pass the error status of work done.
c175160
// Finish waits until all workers have finished working. It would return any // error passed by Done.
c175161
// SetDiscardTs sets a timestamp at or below which, any invalid or deleted // versions can be discarded from the LSM tree, and thence from the value log to // reclaim disk space. Can only be used with managed transactions.
c175162
// openReadOnly assumes that we have a write lock on logFile.
c175163
// iterate iterates over log file. It doesn't not allocate new memory for every kv pair. // Therefore, the kv pair is only valid for the duration of fn call.
c175164
// sortedFids returns the file id's not pending deletion, sorted. Assumes we have shared access to // filesMap.
c175165
// write is thread-unsafe by design and should not be called concurrently.
c175166
// populateDiscardStats populates vlog.lfDiscardStats // This function will be called while initializing valueLog
c175167
// Backup is a wrapper function over Stream.Backup to generate full and incremental backups of the // DB. For more control over how many goroutines are used to generate the backup, or if you wish to // backup only a certain range of keys, use Stream.Backup directly.
c175168
// ToList is a default implementation of KeyToList. It picks up all valid versions of the key, // skipping over deleted or expired keys.
c175169
// keyRange is [start, end), including start, excluding end. Do ensure that the start, // end byte slices are owned by keyRange struct.
c175170
// produceKVs picks up ranges from rangeCh, generates KV lists and sends them to kvChan.
c175171
// Orchestrate runs Stream. It picks up ranges from the SSTables, then runs NumGo number of // goroutines to iterate over these ranges and batch up KVs in lists. It concurrently runs a single // goroutine to pick these lists, batch them up further and send to Output.Send. Orchestrate also // spits logs out to Infof, us...
c175172
// NewStreamAt creates a new Stream at a particular timestamp. Should only be used with managed DB.
c175173
// DecrRef decrements the refcount and possibly deletes the table
c175174
// ParseFileID reads the file id out of a filename.
c175175
// PrintHistogram builds and displays the key-value size histogram. // When keyPrefix is set, only the keys that have prefix "keyPrefix" are // considered for creating the histogram
c175176
// newSizeHistogram returns a new instance of keyValueSizeHistogram with // properly initialized fields.
c175177
// buildHistogram builds the key-value size histogram. // When keyPrefix is set, only the keys that have prefix "keyPrefix" are // considered for creating the histogram
c175178
// printHistogram prints the histogram data in a human-readable format.
c175179
// Init initializes a WaterMark struct. MUST be called before using it.
c175180
// Begin sets the last index to the given value.
c175181
// BeginMany works like Begin but accepts multiple indices.
c175182
// Done sets a single index as done.
c175183
// DoneMany works like Done but accepts multiple indices.
c175184
// SetDoneUntil sets the maximum index that has the property that all indices // less than or equal to it are done.
c175185
// WaitForMark waits until the given index is marked as done.
c175186
// Encode encodes the header.
c175187
// Decode decodes the header.
c175188
// NewTableBuilder makes a new TableBuilder.
c175189
// keyDiff returns a suffix of newKey that is different from b.baseKey.
c175190
// Add adds a key-value pair to the block. // If doNotRestart is true, we will not restart even if b.counter >= restartInterval.
c175191
// blockIndex generates the block index for the table. // It is mainly a list of all the block base offsets.
c175192
// Finish finishes the table by appending the index.
c175193
// Errorf logs an ERROR log message to the logger specified in opts or to the // global logger if no logger is specified in opts.
c175194
// Infof logs an INFO message to the logger specified in opts.
c175195
// DecrRef decrements the refcount, deallocating the Skiplist when done using it
c175196
// NewSkiplist makes a new empty skiplist, with a given arena size
c175197
// Put inserts the key-value pair.
c175198
// Get gets the value associated with the key. It returns a valid value if it finds equal or earlier // version of the same key.
c175199
// Key returns the key at the current position.