Giter Site home page Giter Site logo

zconn's Introduction

20210226-15点42分已弃用,封装的结果应该能够承担起从net.conn到physialnode前的所有相关操作,具体请看新的package riverconn

zconn

为设计好ziyouzy/heartbeating,需要先设计出个基于net.Conn所实现结构类的demo,这样我才能有更多的思路和尝试实现功能的途径和平台


2021年2月14日09点53分: 设计zconn的内部字段时有种感受,zconn本身其实是个数据源,或者说,适配器+上游数据=数据源
也就是说,在zadapter包的演示举例中最初的:

go func(){
    defer close(testBytesSenderCh)
    for i := 1;i < 20;i++{
        testBytesSenderCh <- []byte{0x01, 0x02, 0x03,}
        if i < 10{
            time.Sleep(time.Second)
        }else{
            time.Sleep(60*time.Second)
            i = 1
            fmt.Println("ReStart")
        }
    }
}()

这个环节本身在逻辑上也需要把他设计成一个数据源,或者说适配器+上游数据的形式
或者说根本就不该存在testBytesSenderCh <- []byte{0x01, 0x02, 0x03,}这句
不该存在testBytesSenderCh这个管道,而是直接与下一个节点融合:

go func(){
    //defer close(testBytesSenderCh)
defer close(mainTestHbRawinCh)
    defer close(mainTestStampsRawinCh)
    for i := 1;i < 20;i++{
    //testBytesSenderCh <- []byte{0x01, 0x02, 0x03,}
        bytes := []byte{0x01, 0x02, 0x03,}  /*融合*/
    mainTestHbRawinCh <- struct{}{}     /*融合*/
        mainTestStampsRawinCh <- bytes      /*融合*/
        if i < 10{
            time.Sleep(time.Second)
        }else{
            time.Sleep(60*time.Second)
            i = 1
            fmt.Println("ReStart")
        }
    }
}()

还是以前的写法好,这么写体现不出数据源的独立性,也感受不到数据可能会中断

2021年2月14日09点31分:
调用zadapter库的adapter的map实体时要注意学习go-logger的这段代码:

logFun, ok := adapters[adapterName]
      if !ok {
	        printError("logger: adapter " + adapterName + "is nil!")
      }
adapterLog := logFun()

先取出预加载功能函数,然后通过()拿到对应适配器的实体对象(结构类所实现的接口包括了所有底层数据的功能需求)

zconn's People

Contributors

ziyouzy 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.