Skip to content

lindsuen/canodb

Repository files navigation

CanoDB

Go Reference Go Report Card build GitHub Release GitHub License

Introduction

CanoDB is a distributed key-value database. It provides TCP client and server, expanding the goLevelDB database.

Features

  • Implemented by pure Go, lightweight and fast.
  • Based on gRPC protocol, supports SSL/TLS encryption.

Requirements

  • The environmental requirement is at least Go 1.22.
  • Protocol buffer v3 and Go plugins for the protocol compiler is necessary. Please refer to the official documentation for detailed information.

Usage

The client part is introduced into the code through go import. The server part is compiled and run in binary form or Docker image form.

Client

Download client package:

go get github.com/lindsuen/canodb/client

Import client package and connect to a database:

import "github.com/lindsuen/canodb/client"

// ...
// The default port of CanoDB server is 4644.
db, err := client.Connect("127.0.0.1:4644")
// ...
defer db.Close()
// ...

Read or modify the database content:

// ...
err := db.Put([]byte("key"), []byte("value"))
// ...
err = db.Delete([]byte("key"))
// ...
value, err = db.Get([]byte("key"))
// ...

Server

Place the downloaded or compiled binary file canodb in the corresponding directory, and then execute:

./canodb

Build

It is recommended to build on the Debian or Ubuntu operating system. The make tool is necessary, and you can install it through the command apt install -y build-essential.

Binary

cd canodb/ && go build -o bin/canodb -ldflags "-s -w" .

Docker

cd canodb/ && make build
docker build --no-cache -t canodb/canodb-server:latest .

TODO

  • Synchronize data in the cluster by gRPC protocol.

License

BSD-2-Clause license

About

CanoDB is a distributed key-value database.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages