Git Product home page Git Product logo

pingcap's Introduction

PingCAP

PingCAP 2019校招小作业

开始时间:2018 年 9 月 29日,上午 11:00

截止时间:2018 年 10 月 6 日,上午 11:00

作业要求:在 GitHub 上实现,截止时间前提交项目链接

题目:

  • 系统运维中,有两种管理模式:一种是渐近式的管理方式,一种是一次性管理。前者可以通过某种方式获取应用状态,然后动态对系统进行变更,每次变更可以是很小的一部分,实现自动化运维;后者是运维人员根据开发和线上需求,在上次配置基础上将变更一次性应用到系统中。
  • 对第一种模式,系统时刻在发生变化:应用挂掉、网络故障、机器宕机。应用状态出现异常时,自动化运维需要对应用进行故障转移恢复,保证应用对外正常提供服务。

要求:

  • 实现一个并发安全的任务队列,用户可以将变更计划依次存入该队列,并可以依次从中取出待执行的变更计划来执行,执行完从队列中移除。
  • 如果出现异常情况,用户某个线程关掉队列,其它线程将不能再往任务队列里提交变更计划,并且不能再从队列中获取变更计划。

参考接口:

interface TaskQueue {
  add(Task)
  len() int
  get() (Task, bool)
  done(Task)
  shutdown()
  is_closed() bool
}

提示:

  • 注意代码可读性,添加必要的注释
  • 注意代码风格与规范,添加必要的单元测试和文档
  • 注意异常处理,尝试优化性能

pingcap's People

Contributors

xiaozzz avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  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.