Giter VIP home page Giter VIP logo

annotated-etcd's Introduction

etcd 源码注释

Part1. 官方文档

  1. 分布式系统,底层采用raft作为共识算法
  2. k-v型数据库,其中key类似文件系统的路径
  3. go语言的特性:跨平台、二进制文件小、强大的社区组织

Part2. etcd的编译

  1. 了解go编译的相关参数:如静态编译static、交叉编译GOOS、GOARCH等参数
  2. 常见的参数入口:命令行、环境变量、另一个etcd集群
  3. etcd常见的两种模式:server和proxy,其中后者又细分为四层和七层
  4. etcd用了很多channel,但逻辑都比较简单,这一方面是为了增加代码可读性,另一方面也是防止channel频繁阻塞,带来性能影响

Part3. etcd的get是怎么实现的

  1. 建议的代码结构:定义全局变量(包括常量)、init()函数、Public 方法或结构、私有的方法或结构
  2. etcd的get请求,调用的逻辑比较多,最关键的内容是在mvcc包中,底层的存储依赖于boltdb
  3. interface这个特性,方便了很多复杂对象的抽象,但是在阅读代码时会带来相当的复杂性

我的知识星球 - 免费

欢迎加入我的知识星球

annotated-etcd's People

Contributors

junedayday avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.