All Projects → shafreeck → cetcd

shafreeck / cetcd

Licence: Apache-2.0 license
Cetcd is a C client library for etcd with full features support

Programming Languages

c
50402 projects - #5 most used programming language
Makefile
30231 projects

Labels

Projects that are alternatives of or similar to cetcd

Etcd Watcher
Etcd watcher for Casbin
Stars: ✭ 157 (+137.88%)
Mutual labels:  etcd
Source Code Reading Notes
源码阅读笔记
Stars: ✭ 207 (+213.64%)
Mutual labels:  etcd
Mgmt
Next generation distributed, event-driven, parallel config management!
Stars: ✭ 2,708 (+4003.03%)
Mutual labels:  etcd
Pifpaf
Python fixtures and daemon managing tools for functional testing
Stars: ✭ 161 (+143.94%)
Mutual labels:  etcd
Dcmp
基于etcd的配置管理系统 (etcd v2)
Stars: ✭ 200 (+203.03%)
Mutual labels:  etcd
Skipper
An HTTP router and reverse proxy for service composition, including use cases like Kubernetes Ingress
Stars: ✭ 2,606 (+3848.48%)
Mutual labels:  etcd
Etcd Cloud Operator
Deploying and managing production-grade etcd clusters on cloud providers: failure recovery, disaster recovery, backups and resizing.
Stars: ✭ 149 (+125.76%)
Mutual labels:  etcd
perseus
Perseus is a set of scripts (docker+javascript) to investigate a distributed database's responsiveness when one of its three nodes is isolated from the peers
Stars: ✭ 49 (-25.76%)
Mutual labels:  etcd
Remco
remco is a lightweight configuration management tool
Stars: ✭ 200 (+203.03%)
Mutual labels:  etcd
Forest
分布式任务调度平台,分布式,任务调度,schedule,scheduler
Stars: ✭ 231 (+250%)
Mutual labels:  etcd
Docker Compose
一些基础服务的docker-compose配置文件,方便在一台新电脑上快速开始工作
Stars: ✭ 163 (+146.97%)
Mutual labels:  etcd
Go Flagz
Dynamic flag management for Go.
Stars: ✭ 191 (+189.39%)
Mutual labels:  etcd
Constructr
Coordinated (etcd, ...) cluster construction for dynamic (cloud, containers) environments
Stars: ✭ 219 (+231.82%)
Mutual labels:  etcd
Discovery.etcd.io
etcd discovery service
Stars: ✭ 160 (+142.42%)
Mutual labels:  etcd
Etcdhcp
A DHCP server backed by etcd
Stars: ✭ 250 (+278.79%)
Mutual labels:  etcd
Dotnet Etcd
A C# .NET (dotnet) GRPC client for etcd v3 +
Stars: ✭ 157 (+137.88%)
Mutual labels:  etcd
Dbtester
Distributed database benchmark tester
Stars: ✭ 214 (+224.24%)
Mutual labels:  etcd
sshproxy
Proxy SSH connections on a gateway
Stars: ✭ 75 (+13.64%)
Mutual labels:  etcd
minietcd
☁️ Super small and "dumb" read-only client in Go for coreos/etcd (v2).
Stars: ✭ 12 (-81.82%)
Mutual labels:  etcd
Gosiris
An actor framework for Go
Stars: ✭ 222 (+236.36%)
Mutual labels:  etcd

Cetcd is a C client for etcd

License Gitter Stories in Ready wercker status

Table of Contents generated with DocToc

Status

cetcd is on active development. It aims to be used in production environment and to supply full features of etcd. Any issues or pull requests are welcome!

Features

  • Round-robin load balance and failover
  • Full support for etcd keys space apis
  • Multiple concurrent watchers support

Deps

cetcd use sds as a dynamic string utility. It is licensed in sds/LICENSE. sds is interaged in cetcd's source code, so you don't have to install it before.

yajl is a powerful json stream parsing libaray. We use the stream apis to parse response from cetcd. It is already integrated as a third-party dependency, so you are not necessary to install it before.

curl is required to issue HTTP requests in cetcd

Install

Install curl if needed on Ubuntu

apt-get install libcurl4-openssl-dev

or on CentOS

yum install libcurl-devel

then

make
make install

It default installs to /usr/local.

Use

make install prefix=/path

to specify your custom path.

Link

Use -lcetcd to link the library

Examples

Usage

cetcd_array is an expandable dynamic array. It is used to pass etcd cluster addresses, and return cetcd response nodes

Create an array to store the etcd addresses

    cetcd_array addrs;

    cetcd_array_init(&addrs, 3);
    cetcd_array_append(&addrs, "127.0.0.1:2379");
    cetcd_array_append(&addrs, "127.0.0.1:2378");
    cetcd_array_append(&addrs, "127.0.0.1:2377");

cetcd_client is a context cetcd uses to issue requests, you should init it with etcd addresses

Init the cetcd_client

    cetcd_client cli;
    cetcd_client_init(&cli, &addrs);

Then you can issue an cetcd request which reply with an cetcd response

Set a key

    cetcd_response *resp;
    resp = cetcd_set(&cli, "/service/redis", "hello cetcd", 0);
    if(resp->err) {
        printf("error :%d, %s (%s)\n", resp->err->ecode, resp->err->message, resp->err->cause);
    }
    cetcd_response_release(resp);

Get a key

    cetcd_response *resp;
    resp = cetcd_get(&cli, "/service/redis");
    if(resp->err) {
        printf("error :%d, %s (%s)\n", resp->err->ecode, resp->err->message, resp->err->cause);
    }
    cetcd_response_release(resp);

List a directory

    cetcd_response *resp;
    resp = cetcd_lsdir(&cli, "/service", 1, 1);
    if(resp->err) {
        printf("error :%d, %s (%s)\n", resp->err->ecode, resp->err->message, resp->err->cause);
    }
    cetcd_response_print(resp);
    cetcd_response_release(resp);

Clean all resources

    cetcd_array_destory(&addrs);
    cetcd_client_destroy(&cli);

See examples/cetcdget.c for more detailes

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].