1 sdk structure in lex's rewrite
Alex Grin edited this page 2021-10-22 10:38:54 -04:00

refers to https://github.com/lbryio/lbry-sdk/tree/fast_wallet_server_sync branch

  • overall goal: unify APIs between wallet server and client
  • service dir
    • API - the high-level interface that's shared between wallet server and client
      • wraps Service
      • has info that's used to generate api docs, cli docs/parsing/validation, etc.
    • Service - implements the API. comes in two varieties: LightClient and FullNode
    • LightClient
      • inherits from Service
      • conceptually, requires a connection to another FullNode to interact with blockchain
    • FullNode
      • inherits from Service
      • requires a lbrycrd instance to sync from
  • db dir
    • Database - interface to the database
      • instantiates db
      • mostly calls functions in queries dir
    • queries dir
      • contains the actual sql queries
      • queries written with SQLAlchemy
    • tables.py contains DB table structure
      • migrations are generated from this
      • also used to validate queries (e.g. makes sure the columns extist, types are correct, etc)
  • blockchain dir
    • all new code. pretty self-contained
    • talks to lbrycrd (binary and sqlite db)
    • Ledger
      • similar to chainparams.cpp. defines blockchain constants
    • sync dir - contains all the blockchain sync code
      • has some code to make db calls. would be nice if this code lived in db dir, but it doesn't work in practice