Skip to content

A simple kv storage with persistence mechanism.

Notifications You must be signed in to change notification settings

kadai0308/cleantone

Repository files navigation

cleantone

image
Screen Shot 2023-05-25 at 8 35 35 PM

clonetone, which is made with Golang, offers a user-friendly and easy-to-configure key-value store system with the following features:

  • It incorporates an append log-based persistence system to ensure fast write operations.
  • It automatically prunes data files to minimize disk usage.
  • It is easily configurable, allowing users to adjust the size of each data file and the frequency of pruning.
  • It supports several data persistence formats, including CSV, JSON(WIP), and Protobuf(WIP).

Performance Report

Compare with append to a csv file everytime when do set operation:

image

Read will be the same because both are from memory (use map to do index)

Getting started

Installation

go get github.com/kadai0308/cleantone

Example

    package main
    
    import (
        "github.com/kadai0308/cleantone"
        "log"
    )
    
    func main() {
	dataPath := "FOLDER_PATH_YOU_WANT"
	eachDataFileSize := 10 * cleantone.FileSize.MB
	dataFileFormat := cleantone.DataFormat.CSV
        config := cleantone.DBConfig{
            RotateThreshold: eachDataFileSize,
            DataPath:        dataPath,
            DataFormat:      dataFileFormat,
        }
        DB := cleantone.NewDB(config)

	// In order to persistence the data in memory,
	// remember to call DB.Close() before func return
	defer DB.Close()
        _, err := DB.Get("haha")
        if err != nil {
            log.Fatal(err)
        }
    }

License

cleantone is under the Apache 2.0 license. See the LICENSE file for details.

About

A simple kv storage with persistence mechanism.

Topics

Resources

Stars

Watchers

Forks

Languages