Skip to content

Commit

Permalink
Merge pull request pingcap#750 from pingcap/ngaut/cleanup-kv
Browse files Browse the repository at this point in the history
kv: clean up more
  • Loading branch information
ngaut committed Dec 18, 2015
2 parents 83a3a09 + c7f33cd commit 9030ba8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
24 changes: 24 additions & 0 deletions kv/index_iter.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,30 @@ var (
_ IndexIterator = (*indexIter)(nil)
)

// IndexIterator is the interface for iterator of index data on KV store.
type IndexIterator interface {
Next() (k []interface{}, h int64, err error)
Close()
}

// Index is the interface for index data on KV store.
type Index interface {
// Create supports insert into statement.
Create(rm RetrieverMutator, indexedValues []interface{}, h int64) error
// Delete supports delete from statement.
Delete(m Mutator, indexedValues []interface{}, h int64) error
// Drop supports drop table, drop index statements.
Drop(rm RetrieverMutator) error
// Exist supports check index exists or not.
Exist(rm RetrieverMutator, indexedValues []interface{}, h int64) (bool, int64, error)
// GenIndexKey generates an index key.
GenIndexKey(indexedValues []interface{}, h int64) (key []byte, distinct bool, err error)
// Seek supports where clause.
Seek(r Retriever, indexedValues []interface{}) (iter IndexIterator, hit bool, err error)
// SeekFirst supports aggregate min and ascend order by.
SeekFirst(r Retriever) (iter IndexIterator, err error)
}

func encodeHandle(h int64) []byte {
buf := &bytes.Buffer{}
err := binary.Write(buf, binary.BigEndian, h)
Expand Down
24 changes: 0 additions & 24 deletions kv/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,27 +123,3 @@ type Iterator interface {
Valid() bool
Close()
}

// IndexIterator is the interface for iterator of index data on KV store.
type IndexIterator interface {
Next() (k []interface{}, h int64, err error)
Close()
}

// Index is the interface for index data on KV store.
type Index interface {
// Create supports insert into statement.
Create(rm RetrieverMutator, indexedValues []interface{}, h int64) error
// Delete supports delete from statement.
Delete(m Mutator, indexedValues []interface{}, h int64) error
// Drop supports drop table, drop index statements.
Drop(rm RetrieverMutator) error
// Exist supports check index exists or not.
Exist(rm RetrieverMutator, indexedValues []interface{}, h int64) (bool, int64, error)
// GenIndexKey generates an index key.
GenIndexKey(indexedValues []interface{}, h int64) (key []byte, distinct bool, err error)
// Seek supports where clause.
Seek(r Retriever, indexedValues []interface{}) (iter IndexIterator, hit bool, err error)
// SeekFirst supports aggregate min and ascend order by.
SeekFirst(r Retriever) (iter IndexIterator, err error)
}

0 comments on commit 9030ba8

Please sign in to comment.