-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change API to accept request to verify empty sets.
- Loading branch information
Showing
9 changed files
with
310 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
Package dskvs is an embedded, in memory key value store following the REST | ||
convention of adressing resources as being 'collections' and 'members'. | ||
The main features of dskvs are: | ||
- very high read performance | ||
- high write performance | ||
- safe for concurrent use by multiple readers/writers. | ||
- every read/write is done in memory. Writes are persisted asynchronously | ||
- remains usable under heavy concurrent usage, although throughput is not-optimal | ||
- can load []byte values of any size | ||
- persisted files are always verified for consistency | ||
In dskvs, a collection contains many members, a member contains a value. A full | ||
key is a combination of both the collection and member identifiers to a value. | ||
Example: | ||
fullkey := "artist" + CollKeySep + "Daft Punk" | ||
In this example, 'artist' is a collection that contains many artists. 'Daft Punk' | ||
is one of those artists. | ||
Example: | ||
fullkey := "artist" + CollKeySep + "Daft Punk" + CollKeySep + "Discovery.." | ||
A fullkey can contain many CollKeySep; only the first encountered is considered | ||
for the collection name. | ||
Every entry of dskvs is saved as a file under a path. If you tell dskvs to use | ||
the base path "$HOME/dskvs", it will prepare a filename for your key | ||
such as : | ||
colletion := "This Collection" | ||
key := "Is the Greatest!!!" | ||
escapedKey := filepathSafe(key) // escapes all dangerous characters | ||
truncatedKey := escapedKey[:40] // truncate the key to 40 runes | ||
member := truncatedKey + sha1(key) // append the truncated key to the SHA1 of | ||
// the original key to prevent collisions | ||
dskvs will then write the entry at the path : | ||
$HOME/dskvs/<collection>/<member> | ||
Example: | ||
fullkey := "artist" + CollKeySep + "Daft Punk" + CollKeySep + "Discovery.." | ||
collection := "artist" | ||
member := "Daft+Punk%2FDiscovery..446166742050756e6b2f446973636f766572792e2eda39a3ee5e6b4b0d3255bfef95601890afd80709" | ||
Given that keys have their value escaped, you can safely use any key: | ||
fullkey := "My Collection/../../" | ||
Will yield : | ||
collection == "My Collection" | ||
member == "..%2F..%2F2e2e2f2e2e2fda39a3ee5e6b4b0d3255bfef95601890afd80709" | ||
*/ | ||
package dskvs |
Oops, something went wrong.