DCAS handbook

Server overview

Inputs

flowchart LR

    client[Client]
    client -- https --> api
    client -- websocket --> gw
    client -- https --> cdn
    client -- websocket --> vgw
    client -- stun, srtp --> vsrtp

    main -- unix socket --> vs

    subgraph dcas

        api[API] --> main[Main server]
        gw[Gateway] --> main
        cdn[CDN] --> main

    end

    subgraph voice
        vgw[Voice Gateway] --> vs[Voice server]
        vsrtp[Voice Data] --> vs
    end

Data store

  • Built around of database;
  • Long-term data storage;
  • May be extended/rewritten to support replication;
  • You can read/write data directly;
  • Module emits events when write happens;
  • Each event contains all related info, so you dont have to waste time on DB reads;
  • Events typically meant to be used by Gateway sessions and they more or less follows DC’s Gateway events;
  • Example: someone calls add_reaction. Datastore will emit ChannelEvent::ReactionAdd which contains not only guild_id/message_id/emoji_id, but also User struct describing user that reacted, message author and neccessary emoji data.
flowchart LR

    db[Datastore]

    read --- db
    write --> db
    db --> A@{ shape: processes, label: "events" }