SBS Schema definitionsΒΆ

hat.sbs
module Hat

Msg = Tuple {
    id:     Integer
    first:  Integer
    owner:  Boolean
    token:  Boolean
    last:   Boolean
    data:   Data
}

Data = Tuple {
    module:  Maybe(String)
    type:    String
    data:    Bytes
}
hat/event.sbs
module HatEvent

MsgSubscribe = Array(EventType)

MsgNotify = Array(Event)

MsgRegisterReq = Array(RegisterEvent)

MsgRegisterRes = Array(Union {
    event:    Event
    failure:  None
})

MsgQueryReq = QueryData

MsgQueryRes = Array(Event)

Timestamp = Tuple {
    s:   Integer
    us:  Integer
}

EventId = Tuple {
    server:    Integer
    instance:  Integer
}

Order = Union {
    descending:  None
    ascending:   None
}

OrderBy = Union {
    timestamp:        None
    sourceTimestamp:  None
}

EventType = Array(String)

EventPayload = Union {
    binary:  Bytes
    json:    String
    sbs:     Hat.Data
}

Event = Tuple {
    id:               EventId
    type:             EventType
    timestamp:        Timestamp
    sourceTimestamp:  Maybe(Timestamp)
    payload:          Maybe(EventPayload)
}

RegisterEvent = Tuple {
    type:             EventType
    sourceTimestamp:  Maybe(Timestamp)
    payload:          Maybe(EventPayload)
}

QueryData = Tuple {
    ids:                Maybe(Array(EventId))
    types:              Maybe(Array(EventType))
    tFrom:              Maybe(Timestamp)
    tTo:                Maybe(Timestamp)
    sourceTFrom:        Maybe(Timestamp)
    sourceTTo:          Maybe(Timestamp)
    payload:            Maybe(EventPayload)
    order:              Order
    orderBy:            OrderBy
    uniqueType:         Boolean
    maxResults:         Maybe(Integer)
}
hat/ping.sbs
module HatPing

MsgPing = None

MsgPong = None
hat/monitor.sbs
module HatMonitor

MsgClient = Tuple {
    name:       String
    group:      String
    address:    Maybe(String)
    ready:      Maybe(Integer)
}

MsgServer = Tuple {
    cid:        Integer
    mid:        Integer
    components: Array(ComponentInfo)
}

MsgSlave = Tuple {
    components: Array(ComponentInfo)
}

MsgMaster = Tuple {
    mid:        Integer
    components: Array(ComponentInfo)
}

MsgSetRank = Tuple {
    cid:        Integer
    mid:        Integer
    rank:       Integer
}

ComponentInfo = Tuple {
    cid:        Integer
    mid:        Integer
    name:       String
    group:      String
    address:    Maybe(String)
    rank:       Integer
    blessing:   Maybe(Integer)
    ready:      Maybe(Integer)
}