Giter Site home page Giter Site logo

dbuf's People

Contributors

zieckey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

dbuf's Issues

个人疑问

  1. 为什么不用sync.Map?采用了一个map加上mutex的设计,很奇怪
  2. DoubleBufferingManager.Get获取工作实体对象的时候上锁,DoubleBufferingManager.Add增加工作实体对象的时候却没有上锁?会不会直接并发读写map导致fatal
  3. DoubleBuffering.reload的设计很奇怪,在t.Initialize(conf)必然已经读取文件进到内存了,content, err := ioutil.ReadFile(conf)又读取一次文件进到内存,把文件读了两次?第二次读取文件完全没有任何意义,直接取文件名做md5就可以
// DoubleBuffering.reload 重新加载,加载中需要上锁
func (d *DoubleBuffering) reload(conf string) bool {
   ···
   
   if t.Initialize(conf) == false { // 调用构造函数初始化
      return false
   }

   content, err := ioutil.ReadFile(conf) // 读取文件
   if err != nil {
      content = []byte(conf)
   }
   d.md5h = fmt.Sprintf("%x", md5.Sum(content))
   
   ···
}
  1. 必须要有一个触发的接口来重新导入文件,可以采用http起一个路由,或者rpc调用一次,开一个特殊的接口来触发,感觉限制有点过多

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.