Skip to content

A file based key-value store implemented based on hashtable.

Notifications You must be signed in to change notification settings

KrishKayc/key-value-store-hashtable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

key-value-store-hashtable

A file based key-value store implemented based on hashtable.

Hashtable implementation solves the complexity in fetching the records when comparing to linked list implementation => https://github.com/KrishKayc/key-value-store

Supports string keys and json values, concurrent read and writes from the store and 'eviction' of keys with expiration time.

Functions to Create, Get, check if key Exists and Delete a key from the store

Usage

  //Object in the application
  person := Person{ID: 12568, Name: "some test user"}
  v, _ := json.Marshal(person)
  
  //create new KV store in specified path
  db := NewKVStore("E:\\test2")
  defer db.Close()
  
  //Add to store
  db.Create("key1", v, 0)
  
  //Get from store
  value, err := db.Get(k)
  var p1 Person
  json.Unmarshal(value, &p1)
  

TODO :

  • Fix the hashing function and collision handling function
  • Currently supports 1GB of storage, must be made configurable.
  • Supports values upto 16KB in size and keys lenght is truncated to 32 chars, this also need to be configurable

About

A file based key-value store implemented based on hashtable.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages