Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split database to index and key-value store #107

Closed
logrusorgru opened this issue Aug 20, 2017 · 2 comments
Closed

Split database to index and key-value store #107

logrusorgru opened this issue Aug 20, 2017 · 2 comments
Assignees
Milestone

Comments

@logrusorgru
Copy link
Contributor

The data package represents database and keeps all inside.
We need to split it for two separate packages:

  1. key-value store with API
  • get []byte by hash
  • set hash-[]byte pair
  • increment refs count of an object by hash
  • decrement the refs count

While the refs count is zero, object should be deleted. This part will be moved to server later

  1. machine local index DB that keeps meta information for every object
  • the size of value

  • when key was created
  • the number of accesses
  • last access time
  • ref count
@logrusorgru logrusorgru self-assigned this Aug 20, 2017
@logrusorgru logrusorgru added this to the cxo 2.0 milestone Aug 20, 2017
@logrusorgru
Copy link
Contributor Author

logrusorgru commented Aug 29, 2017

A way to handle "not found" error required.

The DB has been splited to two separate packages one of which is key-value store and can be replaced with any other package that implements following interface:

type CXDS interface {
	Get(key cipher.SHA256) (val []byte, rc uint32, err error)
	Set(key cipher.SHA256, val []byte) (rc uint32, err error)
	Add(val []byte) (key cipher.SHA256, rc uint32, err error)
	Inc(key cipher.SHA256) (rc uint32, err error)
	Dec(key cipher.SHA256) (rc uint32, err error)

	MultiGet(keys []cipher.SHA256) (vals [][]byte, err error)
	MultiAdd(vals [][]byte) (err error)

	MultiInc(keys []cipher.SHA256) (err error)
	MultiDec(keys []cipher.SHA256) (err error)
	Close() (err error)
}

TODO:

  • solve the ErrNotFound problem

@logrusorgru
Copy link
Contributor Author

Fixed by the #116

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant