aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer
diff options
context:
space:
mode:
Diffstat (limited to 'Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer')
-rw-r--r--Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer/bytes_comparer.go51
-rw-r--r--Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer/comparer.go57
2 files changed, 0 insertions, 108 deletions
diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer/bytes_comparer.go b/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer/bytes_comparer.go
deleted file mode 100644
index 14dddf88d..000000000
--- a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer/bytes_comparer.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2012, Suryandaru Triandana <syndtr@gmail.com>
-// All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package comparer
-
-import "bytes"
-
-type bytesComparer struct{}
-
-func (bytesComparer) Compare(a, b []byte) int {
- return bytes.Compare(a, b)
-}
-
-func (bytesComparer) Name() string {
- return "leveldb.BytewiseComparator"
-}
-
-func (bytesComparer) Separator(dst, a, b []byte) []byte {
- i, n := 0, len(a)
- if n > len(b) {
- n = len(b)
- }
- for ; i < n && a[i] == b[i]; i++ {
- }
- if i >= n {
- // Do not shorten if one string is a prefix of the other
- } else if c := a[i]; c < 0xff && c+1 < b[i] {
- dst = append(dst, a[:i+1]...)
- dst[i]++
- return dst
- }
- return nil
-}
-
-func (bytesComparer) Successor(dst, b []byte) []byte {
- for i, c := range b {
- if c != 0xff {
- dst = append(dst, b[:i+1]...)
- dst[i]++
- return dst
- }
- }
- return nil
-}
-
-// DefaultComparer are default implementation of the Comparer interface.
-// It uses the natural ordering, consistent with bytes.Compare.
-var DefaultComparer = bytesComparer{}
diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer/comparer.go b/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer/comparer.go
deleted file mode 100644
index 14a28f16f..000000000
--- a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/comparer/comparer.go
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2012, Suryandaru Triandana <syndtr@gmail.com>
-// All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Package comparer provides interface and implementation for ordering
-// sets of data.
-package comparer
-
-// BasicComparer is the interface that wraps the basic Compare method.
-type BasicComparer interface {
- // Compare returns -1, 0, or +1 depending on whether a is 'less than',
- // 'equal to' or 'greater than' b. The two arguments can only be 'equal'
- // if their contents are exactly equal. Furthermore, the empty slice
- // must be 'less than' any non-empty slice.
- Compare(a, b []byte) int
-}
-
-// Comparer defines a total ordering over the space of []byte keys: a 'less
-// than' relationship.
-type Comparer interface {
- BasicComparer
-
- // Name returns name of the comparer.
- //
- // The Level-DB on-disk format stores the comparer name, and opening a
- // database with a different comparer from the one it was created with
- // will result in an error.
- //
- // An implementation to a new name whenever the comparer implementation
- // changes in a way that will cause the relative ordering of any two keys
- // to change.
- //
- // Names starting with "leveldb." are reserved and should not be used
- // by any users of this package.
- Name() string
-
- // Bellow are advanced functions used used to reduce the space requirements
- // for internal data structures such as index blocks.
-
- // Separator appends a sequence of bytes x to dst such that a <= x && x < b,
- // where 'less than' is consistent with Compare. An implementation should
- // return nil if x equal to a.
- //
- // Either contents of a or b should not by any means modified. Doing so
- // may cause corruption on the internal state.
- Separator(dst, a, b []byte) []byte
-
- // Successor appends a sequence of bytes x to dst such that x >= b, where
- // 'less than' is consistent with Compare. An implementation should return
- // nil if x equal to b.
- //
- // Contents of b should not by any means modified. Doing so may cause
- // corruption on the internal state.
- Successor(dst, b []byte) []byte
-}