# automatically generated by the FlatBuffers compiler, do not modify

# namespace: log

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

# Heartbeat log record from managed node workers. Primary key: (timestamp, node_id, worker_id).
class MWorkerLog(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAsMWorkerLog(cls, buf, offset):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = MWorkerLog()
        x.Init(buf, n + offset)
        return x

    # MWorkerLog
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # Primary key: Unix time in ns when this log record was received (from CFC node clock).
    # MWorkerLog
    def Timestamp(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # Primary key: CF node ID.
    # MWorkerLog
    def NodeId(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
        return 0

    # MWorkerLog
    def NodeIdAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
        return 0

    # MWorkerLog
    def NodeIdLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # MWorkerLog
    def NodeIdIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        return o == 0

    # Primary key: Local Worker ID on running CF node.
    # MWorkerLog
    def WorkerId(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Heartbeat period in seconds encompassed by this record.
    # MWorkerLog
    def Period(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
        return 0

    # Management realm ID.
    # MWorkerLog
    def MrealmId(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
        return 0

    # MWorkerLog
    def MrealmIdAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
        return 0

    # MWorkerLog
    def MrealmIdLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # MWorkerLog
    def MrealmIdIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        return o == 0

    # Type of worker.
    # MWorkerLog
    def Type(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
        return 0

    # Current state of worker.
    # MWorkerLog
    def State(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
        return 0

    # Unix time in ns. This timestamp is from the original received event payload (from CF node clock).
    # MWorkerLog
    def Sent(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # Sequence number as sent in the log record by the CF node (started at 0 for CF start and incremented by one on each heartbeat).
    # MWorkerLog
    def Seq(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # Current load.
    # MWorkerLog
    def NumFds(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def NumThreads(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint16Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def NumCtxSwitchesInvoluntary(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def NumCtxSwitchesInvoluntaryPerSec(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def NumCtxSwitchesVoluntary(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def NumCtxSwitchesVoluntaryPerSec(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
        return 0

    # CPU load
    # MWorkerLog
    def CpuSystem(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(34))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # MWorkerLog
    def CpuSystemPerSec(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # MWorkerLog
    def CpuWait(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(38))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # MWorkerLog
    def CpuWaitPerSec(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(40))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # MWorkerLog
    def CpuUser(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(42))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # MWorkerLog
    def CpuUserPerSec(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(44))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # Disk load
    # MWorkerLog
    def ReadBytes(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(46))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def ReadBytesPerSec(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(48))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def ReadIos(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(50))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def ReadIosPerSec(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(52))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def WriteBytes(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(54))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def WriteBytesPerSec(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(56))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def WriteIos(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(58))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def WriteIosPerSec(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(60))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # Network load
    # MWorkerLog
    def SentBytes(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(62))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def SentBytesPerSec(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(64))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def SentIos(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(66))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def SentIosPerSec(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(68))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def RecvBytes(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(70))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def RecvBytesPerSec(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(72))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def RecvIos(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(74))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def RecvIosPerSec(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(76))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # WAMP roles defined on a router worker
    # MWorkerLog
    def RouterRoles(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(78))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # WAMP sessions joined on a router worker
    # MWorkerLog
    def RouterSessions(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(80))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # WAMP messages processed by a router worker
    # MWorkerLog
    def RecvCall(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(82))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def RecvYield(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(84))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def SentInvocation(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(86))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def SentResult(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(88))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def RecvPublish(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(90))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def SentPublished(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(92))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def SentEvent(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(94))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def RecvRegister(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(96))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def SentRegistered(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(98))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def RecvSubscribe(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(100))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # MWorkerLog
    def SentSubscribed(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(102))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

def MWorkerLogStart(builder): builder.StartObject(50)
def MWorkerLogAddTimestamp(builder, timestamp): builder.PrependUint64Slot(0, timestamp, 0)
def MWorkerLogAddNodeId(builder, nodeId): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(nodeId), 0)
def MWorkerLogStartNodeIdVector(builder, numElems): return builder.StartVector(1, numElems, 1)
def MWorkerLogAddWorkerId(builder, workerId): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(workerId), 0)
def MWorkerLogAddPeriod(builder, period): builder.PrependUint32Slot(3, period, 0)
def MWorkerLogAddMrealmId(builder, mrealmId): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(mrealmId), 0)
def MWorkerLogStartMrealmIdVector(builder, numElems): return builder.StartVector(1, numElems, 1)
def MWorkerLogAddType(builder, type): builder.PrependUint8Slot(5, type, 0)
def MWorkerLogAddState(builder, state): builder.PrependUint8Slot(6, state, 0)
def MWorkerLogAddSent(builder, sent): builder.PrependUint64Slot(7, sent, 0)
def MWorkerLogAddSeq(builder, seq): builder.PrependUint64Slot(8, seq, 0)
def MWorkerLogAddNumFds(builder, numFds): builder.PrependUint32Slot(9, numFds, 0)
def MWorkerLogAddNumThreads(builder, numThreads): builder.PrependUint16Slot(10, numThreads, 0)
def MWorkerLogAddNumCtxSwitchesInvoluntary(builder, numCtxSwitchesInvoluntary): builder.PrependUint64Slot(11, numCtxSwitchesInvoluntary, 0)
def MWorkerLogAddNumCtxSwitchesInvoluntaryPerSec(builder, numCtxSwitchesInvoluntaryPerSec): builder.PrependUint32Slot(12, numCtxSwitchesInvoluntaryPerSec, 0)
def MWorkerLogAddNumCtxSwitchesVoluntary(builder, numCtxSwitchesVoluntary): builder.PrependUint64Slot(13, numCtxSwitchesVoluntary, 0)
def MWorkerLogAddNumCtxSwitchesVoluntaryPerSec(builder, numCtxSwitchesVoluntaryPerSec): builder.PrependUint32Slot(14, numCtxSwitchesVoluntaryPerSec, 0)
def MWorkerLogAddCpuSystem(builder, cpuSystem): builder.PrependFloat32Slot(15, cpuSystem, 0.0)
def MWorkerLogAddCpuSystemPerSec(builder, cpuSystemPerSec): builder.PrependFloat32Slot(16, cpuSystemPerSec, 0.0)
def MWorkerLogAddCpuWait(builder, cpuWait): builder.PrependFloat32Slot(17, cpuWait, 0.0)
def MWorkerLogAddCpuWaitPerSec(builder, cpuWaitPerSec): builder.PrependFloat32Slot(18, cpuWaitPerSec, 0.0)
def MWorkerLogAddCpuUser(builder, cpuUser): builder.PrependFloat32Slot(19, cpuUser, 0.0)
def MWorkerLogAddCpuUserPerSec(builder, cpuUserPerSec): builder.PrependFloat32Slot(20, cpuUserPerSec, 0.0)
def MWorkerLogAddReadBytes(builder, readBytes): builder.PrependUint64Slot(21, readBytes, 0)
def MWorkerLogAddReadBytesPerSec(builder, readBytesPerSec): builder.PrependUint64Slot(22, readBytesPerSec, 0)
def MWorkerLogAddReadIos(builder, readIos): builder.PrependUint64Slot(23, readIos, 0)
def MWorkerLogAddReadIosPerSec(builder, readIosPerSec): builder.PrependUint64Slot(24, readIosPerSec, 0)
def MWorkerLogAddWriteBytes(builder, writeBytes): builder.PrependUint64Slot(25, writeBytes, 0)
def MWorkerLogAddWriteBytesPerSec(builder, writeBytesPerSec): builder.PrependUint64Slot(26, writeBytesPerSec, 0)
def MWorkerLogAddWriteIos(builder, writeIos): builder.PrependUint64Slot(27, writeIos, 0)
def MWorkerLogAddWriteIosPerSec(builder, writeIosPerSec): builder.PrependUint64Slot(28, writeIosPerSec, 0)
def MWorkerLogAddSentBytes(builder, sentBytes): builder.PrependUint64Slot(29, sentBytes, 0)
def MWorkerLogAddSentBytesPerSec(builder, sentBytesPerSec): builder.PrependUint64Slot(30, sentBytesPerSec, 0)
def MWorkerLogAddSentIos(builder, sentIos): builder.PrependUint64Slot(31, sentIos, 0)
def MWorkerLogAddSentIosPerSec(builder, sentIosPerSec): builder.PrependUint64Slot(32, sentIosPerSec, 0)
def MWorkerLogAddRecvBytes(builder, recvBytes): builder.PrependUint64Slot(33, recvBytes, 0)
def MWorkerLogAddRecvBytesPerSec(builder, recvBytesPerSec): builder.PrependUint64Slot(34, recvBytesPerSec, 0)
def MWorkerLogAddRecvIos(builder, recvIos): builder.PrependUint64Slot(35, recvIos, 0)
def MWorkerLogAddRecvIosPerSec(builder, recvIosPerSec): builder.PrependUint64Slot(36, recvIosPerSec, 0)
def MWorkerLogAddRouterRoles(builder, routerRoles): builder.PrependUint64Slot(37, routerRoles, 0)
def MWorkerLogAddRouterSessions(builder, routerSessions): builder.PrependUint64Slot(38, routerSessions, 0)
def MWorkerLogAddRecvCall(builder, recvCall): builder.PrependUint64Slot(39, recvCall, 0)
def MWorkerLogAddRecvYield(builder, recvYield): builder.PrependUint64Slot(40, recvYield, 0)
def MWorkerLogAddSentInvocation(builder, sentInvocation): builder.PrependUint64Slot(41, sentInvocation, 0)
def MWorkerLogAddSentResult(builder, sentResult): builder.PrependUint64Slot(42, sentResult, 0)
def MWorkerLogAddRecvPublish(builder, recvPublish): builder.PrependUint64Slot(43, recvPublish, 0)
def MWorkerLogAddSentPublished(builder, sentPublished): builder.PrependUint64Slot(44, sentPublished, 0)
def MWorkerLogAddSentEvent(builder, sentEvent): builder.PrependUint64Slot(45, sentEvent, 0)
def MWorkerLogAddRecvRegister(builder, recvRegister): builder.PrependUint64Slot(46, recvRegister, 0)
def MWorkerLogAddSentRegistered(builder, sentRegistered): builder.PrependUint64Slot(47, sentRegistered, 0)
def MWorkerLogAddRecvSubscribe(builder, recvSubscribe): builder.PrependUint64Slot(48, recvSubscribe, 0)
def MWorkerLogAddSentSubscribed(builder, sentSubscribed): builder.PrependUint64Slot(49, sentSubscribed, 0)
def MWorkerLogEnd(builder): return builder.EndObject()
