Skip to content

Commit

Permalink
Fix lll (long line) warnings. (dgraph-io#852)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmr authored Jun 7, 2019
1 parent cd5884e commit 3e0e35e
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 16 deletions.
3 changes: 2 additions & 1 deletion badger/cmd/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ func tableInfo(dir, valueDir string, db *badger.DB) {
// we want all tables with keys count here.
tables := db.Tables(true)
fmt.Println()
fmt.Println("SSTable [Li, Id, Total Keys including internal keys] [Left Key, Version -> Right Key, Version]")
fmt.Println("SSTable [Li, Id, Total Keys including internal keys] " +
"[Left Key, Version -> Right Key, Version]")
for _, t := range tables {
lk, lt := y.ParseKey(t.Left), y.ParseTs(t.Left)
rk, rt := y.ParseKey(t.Right), y.ParseTs(t.Right)
Expand Down
3 changes: 2 additions & 1 deletion dir_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ type directoryLockGuard struct {
// acquireDirectoryLock gets a lock on the directory (using flock). If
// this is not read-only, it will also write our pid to
// dirPath/pidFileName for convenience.
func acquireDirectoryLock(dirPath string, pidFileName string, readOnly bool) (*directoryLockGuard, error) {
func acquireDirectoryLock(dirPath string, pidFileName string, readOnly bool) (
*directoryLockGuard, error) {
// Convert to absolute path so that Release still works even if we do an unbalanced
// chdir in the meantime.
absPidFilePath, err := filepath.Abs(filepath.Join(dirPath, pidFileName))
Expand Down
7 changes: 4 additions & 3 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ var (
// ErrTxnTooBig is returned if too many writes are fit into a single transaction.
ErrTxnTooBig = errors.New("Txn is too big to fit into one request")

// ErrConflict is returned when a transaction conflicts with another transaction. This can happen if
// the read rows had been updated concurrently by another transaction.
// ErrConflict is returned when a transaction conflicts with another transaction. This can
// happen if the read rows had been updated concurrently by another transaction.
ErrConflict = errors.New("Transaction Conflict. Please retry")

// ErrReadOnlyTxn is returned if an update function is called on a read-only transaction.
Expand Down Expand Up @@ -97,7 +97,8 @@ var (

// ErrTruncateNeeded is returned when the value log gets corrupt, and requires truncation of
// corrupt data to allow Badger to run properly.
ErrTruncateNeeded = errors.New("Value log truncate required to run DB. This might result in data loss")
ErrTruncateNeeded = errors.New(
"Value log truncate required to run DB. This might result in data loss")

// ErrBlockedWrites is returned if the user called DropAll. During the process of dropping all
// data from Badger, we stop accepting new writes, by returning this error.
Expand Down
6 changes: 3 additions & 3 deletions iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -648,9 +648,9 @@ func (it *Iterator) prefetch() {
}
}

// Seek would seek to the provided key if present. If absent, it would seek to the next smallest key
// greater than the provided key if iterating in the forward direction. Behavior would be reversed if
// iterating backwards.
// Seek would seek to the provided key if present. If absent, it would seek to the next
// smallest key greater than the provided key if iterating in the forward direction.
// Behavior would be reversed if iterating backwards.
func (it *Iterator) Seek(key []byte) {
for i := it.data.pop(); i != nil; i = it.data.pop() {
i.wg.Wait()
Expand Down
3 changes: 2 additions & 1 deletion levels.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,8 @@ func (s *levelsController) compactBuildTables(

vs := it.Value()
version := y.ParseTs(it.Key())
// Do not discard entries inserted by merge operator. These entries will be discarded once they're merged
// Do not discard entries inserted by merge operator. These entries will be
// discarded once they're merged
if version <= discardTs && vs.Meta&bitMergeEntry == 0 {
// Keep track of the number of versions encountered for this key. Only consider the
// versions which are below the minReadTs, otherwise, we might end up discarding the
Expand Down
7 changes: 5 additions & 2 deletions manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,14 @@ func (m *Manifest) clone() Manifest {

// openOrCreateManifestFile opens a Badger manifest file if it exists, or creates on if
// one doesn’t.
func openOrCreateManifestFile(dir string, readOnly bool) (ret *manifestFile, result Manifest, err error) {
func openOrCreateManifestFile(dir string, readOnly bool) (
ret *manifestFile, result Manifest, err error) {
return helpOpenOrCreateManifestFile(dir, readOnly, manifestDeletionsRewriteThreshold)
}

func helpOpenOrCreateManifestFile(dir string, readOnly bool, deletionsThreshold int) (ret *manifestFile, result Manifest, err error) {
func helpOpenOrCreateManifestFile(dir string, readOnly bool, deletionsThreshold int) (
ret *manifestFile, result Manifest, err error) {

path := filepath.Join(dir, ManifestFilename)
var flags uint32
if readOnly {
Expand Down
3 changes: 2 additions & 1 deletion structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ func (h *header) Decode(buf []byte) {
h.userMeta = buf[17]
}

// Entry provides Key, Value, UserMeta and ExpiresAt. This struct can be used by the user to set data.
// Entry provides Key, Value, UserMeta and ExpiresAt. This struct can be used by
// the user to set data.
type Entry struct {
Key []byte
Value []byte
Expand Down
6 changes: 4 additions & 2 deletions table/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,15 @@ func (b *Builder) Add(key []byte, value y.ValueStruct) error {
}

// TODO: vvv this was the comment on ReachedCapacity.
// FinalSize returns the *rough* final size of the array, counting the header which is not yet written.
// FinalSize returns the *rough* final size of the array, counting the header which is
// not yet written.
// TODO: Look into why there is a discrepancy. I suspect it is because of Write(empty, empty)
// at the end. The diff can vary.

// ReachedCapacity returns true if we... roughly (?) reached capacity?
func (b *Builder) ReachedCapacity(cap int64) bool {
estimateSz := b.buf.Len() + 8 /* empty header */ + 4*len(b.restarts) + 8 // 8 = end of buf offset + len(restarts).
estimateSz := b.buf.Len() + 8 /* empty header */ + 4*len(b.restarts) +
8 /* 8 = end of buf offset + len(restarts) */
return int64(estimateSz) > cap
}

Expand Down
4 changes: 2 additions & 2 deletions y/watermark.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ func (w *WaterMark) process(closer *Closer) {
loop++
if len(indices) > 0 && loop%10000 == 0 {
min := indices[0]
w.elog.Printf("WaterMark %s: Done entry %4d. Size: %4d Watermark: %-4d Looking for: %-4d. Value: %d\n",
w.Name, index, len(indices), w.DoneUntil(), min, pending[min])
w.elog.Printf("WaterMark %s: Done entry %4d. Size: %4d Watermark: %-4d Looking for: "+
"%-4d. Value: %d\n", w.Name, index, len(indices), w.DoneUntil(), min, pending[min])
}

// Update mark by going through all indices in order; and checking if they have
Expand Down

0 comments on commit 3e0e35e

Please sign in to comment.