Coder Social home page Coder Social logo

goechoton's Introduction

Hi! I'm xiaoye 👋

  • 🔭 I’m currently working on game company.
  • ⚡ Golang/Python/C/C++/C#.
  • 📫 How to reach me: [email protected]
  • 🍻 Guangzhou,China

goechoton's People

Contributors

trainking avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

goechoton's Issues

etcdx包增加分布式锁的实现

分布式锁应该保证以下:

  • 独占性,排他锁的必然
  • 公平性,多个申请者申请,减少非设定不公平
  • 可以通过机制,让特定申请者优先获得锁

增加IPv4过滤中间件

  • 黑名单过滤中间件,支持网络号
  • 白名单过滤中间件,支持网络号,支持*代表所有地址可通过,空代表不许任何ip通过
  • ip解析地域限制,需要依赖地址解析库(非必做)

增加RequestID标识请求

RequestID需要实现以下功能:

  • 全局唯一不重复
  • 可以在log中输出
  • 传递到rpc中,识别调用链路

上传文件控件

  1. 可以上传多个文件
  2. 上传文件到指定目录
  3. 表单可以额外增加数据

增加makefile管理项目

makefile需要管理以下操作:

  • 代码生成,标志gen
  • 自动化白盒测试
  • Docker镜像打包
  • 代码和配置文件检查

如何做到路由向下兼容

假设api存在v1和v2两套路由,则存在下列情况:

两套路由兼容

  • 访问v2路由,则如果v2不可用,降级访问到v1
  • 访问v1路由,如果v1不可用,是否升级访问v2路由?

两套路由不兼容

互相之间不做升降级操作

错误码包

错误码设计需求:

  • 错误码使用int
  • 通过错误码位数区分服务-业务-类型
  • 错误码有对应的msg
  • msg要能够实现多语言
  • msg可以通过传入数据,生成
  • 实现Error()接口

[mark] 记录技巧和片段

Echo中,使用middleware作为全局中间件时,需要注意,echo.Request().Body 是一个io.ReadCloser

读出数据之后,要重新建立一个io.ReadCloser放回去,不然会导致下一个处理中,读取不到数据,报EOF错误。

bodyContens, err := ioutil.ReadAll(req.Body)
...

req.Body = ioutil.NopCloser(bytes.NewReader(bodyContens))

批处理模块

该模块具有以下功能:

  • 定时任务执行
  • 每次执行需要满足幂等性
  • 每次执行返回error,记录错误日志
  • 提供执行失败,补充再次执行方案(可人工介入)
  • 每次执行要有唯一标识id

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.