Code Monkey home page Code Monkey logo

resonance's Introduction

雷索纳斯数据站

完全没有完成,public仓库是因为github actions私有仓库不好搞

2024.4.12: 因为AWS很贵所以项目暂且搁置,没有完成的预定,只是对我来说的新奇技术的实验场

目前完成的部分:

  • 同一k8s集群下,后端服务之间以及与前端服务之间的gRPC通信(使用connecttrpc规避不生成es6代码的问题)
  • 所有基础设施的代码化(Terraform)

服务定义

  • rds: 存储user等持久化数据
  • redis: 存储商品数据
  • info: 从数据库中获取数据/储存数据
  • calculate: 计算数据
  • api: grpc定义
  • api-gateway: 负载均衡?流量转发?防火墙?
  • frontend: 前端

数据库定义

redis

station:StationId {
    Name
    Des
    AttachedToCity
    SellList
    AcquisitionList: 必须在good:quotation初始化后
}

good:info:GoodUniqueId {
    Name
    Description
    IsSpeciality
    QuotationVariation
    FastQuotationVariation
    ProducerList
}

good:buy:GoodBuyId {
    GoodsId
    StationId: 通过station:StationId.AcquisitionList来设定
    BaseBuyPrice
    BuyPrice
    BuyPriceHistory
    MinQuotation
    MaxQuotation
}

good:sell:GoodSellId {
    GoodsId
    StationId: 通过station:StationId.AcquisitionList来设定
    BaseSellPrice 
    SellPrice
    SellPriceHistory
    MinQuotation
    MaxQuotation
}

info 服务

接受gRPC通信或者Restful通信,从redis/rds中获取/储存数据

gRPC

为了给其他服务(如calculate)提供数据

  • getSellGoods => BuyGood[]
  • getBuyGoods => SellGood[]
  • getStations => Station[]
  • getUser => User

BuyGood:

GoodBuyId {
    GoodUniqueId
    Name
    StationId
    BaseBuyPrice
    BuyPrice
    BuyPriceHistory
    QuotationVariation
    FastQuotationVariation
    MinQuotation
    MaxQuotation
}

Restful(由网关路由)

为了:

  • 从外界接受到数据更新
  • 为其他开发者提供基本的数据

GET

/goodsinfo: 返回商品数据,可选参数包括:

  • action=[buy, sell]: 筛选是购买数据还是贩卖数据
  • stationID: 筛选地点
  • name: 筛选商品名称
  • goodsId: 筛选商品Id

/stationsinfo: 返回站点数据

/user: 返回用户数据

POST

/goodsinfo: 必选参数为:

  • stationID

body数据应为一个{buyList:{}, sellList:{}}

可选参数为:

  • goodsID
  • action=[buy, sell]

body数据应为一个简单的商品数据

/user: 修改用户数据

calculate 服务

根据info服务,与Restful API请求方提供的数据(或用户数据),计算:

  • 详细的商品情报(包括利润,百分比)
  • 跑商路线

Types定义

  • 解包文件JSON的StationJSON
  • redis中数据存储的Station
  • 用于传输的完整数据api.Station

resonance's People

Contributors

kud-00 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.