Sign in

    weopqrst/moonroll/protocol does not have a README file

    ChecksumFrame

    pub(all) struct ChecksumFrame {
    frame : Int
    hash : UInt64
    } derive(Eq)

    ChecksumFrame::new

    fn ChecksumFrame::new(frame : Int, hash : UInt64) -> ChecksumFrame

    ConfirmFrame

    pub(all) struct ConfirmFrame {
    frame : Int
    } derive(Eq)

    ConfirmFrame::new

    fn ConfirmFrame::new(frame : Int) -> ConfirmFrame

    InputFrame

    pub(all) struct InputFrame {
    frame : Int
    inputs : Array[UInt64]
    } derive(Eq)

    紧凑字节协议:输入帧 / 确认帧 / 校验和帧。

    线上格式(小端,varint 为 LEB128):
    Input : [0x01][varint frame][varint count][varint bits] * count Confirm : [0x02][varint frame] Checksum : [0x03][varint frame][8 bytes hash]

    InputFrame::new

    fn InputFrame::new(frame : Int, inputs : Array[UInt64]) -> InputFrame

    Message

    pub(all) enum Message {
    Input(InputFrame)
    Confirm(ConfirmFrame)
    Checksum(ChecksumFrame)
    } derive(Eq)

    decode

    fn decode(buf : Bytes) -> Message?

    decode_batch

    fn decode_batch(buf : Bytes) -> Array[Message]

    encode

    fn encode(msg : Message) -> Bytes

    encode_batch

    fn encode_batch(msgs : Array[Message]) -> Bytes

    Source Files