<schema package="org.apache.qpid.legacystore">

<!--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
-->

  <class name="Store">
    <property name="brokerRef"               type="objId"  access="RO" references="qpid.Broker" index="y" parentRef="y"/>
    <property name="location"                type="sstr"   access="RO"              desc="Logical directory on disk"/>
    <property name="defaultInitialFileCount" type="uint16" access="RO" unit="file"  desc="Default number of files initially allocated to each journal"/>
    <property name="defaultDataFileSize"     type="uint32" access="RO" unit="RdPg"  desc="Default size of each journal data file"/>
    <property name="tplIsInitialized"        type="bool"   access="RO"              desc="Transaction prepared list has been initialized by a transactional prepare"/>
    <property name="tplDirectory"            type="sstr"   access="RO"              desc="Transaction prepared list directory"/>
    <property name="tplWritePageSize"        type="uint32" access="RO" unit="byte"  desc="Page size in transaction prepared list write-page-cache"/>
    <property name="tplWritePages"           type="uint32" access="RO" unit="wpage" desc="Number of pages in transaction prepared list write-page-cache"/>
    <property name="tplInitialFileCount"     type="uint16" access="RO" unit="file"  desc="Number of files initially allocated to transaction prepared list journal"/>
    <property name="tplDataFileSize"         type="uint32" access="RO" unit="byte"  desc="Size of each journal data file in transaction prepared list journal"/>
    <property name="tplCurrentFileCount"     type="uint32" access="RO" unit="file"  desc="Number of files currently allocated to transaction prepared list journal"/>

    <statistic name="tplTransactionDepth"    type="hilo32"  unit="txn"    desc="Number of currently enqueued prepared transactions"/>
    <statistic name="tplTxnPrepares"         type="count64" unit="record" desc="Total transaction prepares on transaction prepared list"/>
    <statistic name="tplTxnCommits"          type="count64" unit="record" desc="Total transaction commits on transaction prepared list"/>
    <statistic name="tplTxnAborts"           type="count64" unit="record" desc="Total transaction aborts on transaction prepared list"/>
    <statistic name="tplOutstandingAIOs"     type="hilo32"  unit="aio_op" desc="Number of currently outstanding AIO requests in Async IO system"/>
  </class>

  <class name="Journal">
    <property name="queueRef"           type="objId"  access="RO" references="qpid.Queue" isGeneralReference="y"/>
    <property name="name"               type="sstr"   access="RO" index="y"/>
    <property name="directory"          type="sstr"   access="RO"              desc="Directory containing journal files"/>
    <property name="baseFileName"       type="sstr"   access="RO"              desc="Base filename prefix for journal"/>
    <property name="writePageSize"      type="uint32" access="RO" unit="byte"  desc="Page size in write-page-cache"/>
    <property name="writePages"         type="uint32" access="RO" unit="wpage" desc="Number of pages in write-page-cache"/>
    <property name="readPageSize"       type="uint32" access="RO" unit="byte"  desc="Page size in read-page-cache"/>
    <property name="readPages"          type="uint32" access="RO" unit="rpage" desc="Number of pages in read-page-cache"/>
    <property name="initialFileCount"   type="uint16" access="RO" unit="file"  desc="Number of files initially allocated to this journal"/>
    <property name="autoExpand"         type="bool"   access="RO"              desc="Auto-expand enabled"/>
    <property name="currentFileCount"   type="uint16" access="RO" unit="file"  desc="Number of files currently allocated to this journal"/>
    <property name="maxFileCount"       type="uint16" access="RO" unit="file"  desc="Max number of files allowed for this journal"/>
    <property name="dataFileSize"       type="uint32" access="RO" unit="byte"  desc="Size of each journal data file"/>

    <statistic name="recordDepth"       type="hilo32"  unit="record" desc="Number of currently enqueued records (durable messages)"/>
    <statistic name="enqueues"          type="count64" unit="record" desc="Total enqueued records on journal"/>
    <statistic name="dequeues"          type="count64" unit="record" desc="Total dequeued records on journal"/>
    <statistic name="txn"               type="count32" unit="record" desc="Total open transactions (xids) on journal"/>
    <statistic name="txnEnqueues"       type="count64" unit="record" desc="Total transactional enqueued records on journal"/>
    <statistic name="txnDequeues"       type="count64" unit="record" desc="Total transactional dequeued records on journal"/>
    <statistic name="txnCommits"        type="count64" unit="record" desc="Total transactional commit records on journal"/>
    <statistic name="txnAborts"         type="count64" unit="record" desc="Total transactional abort records on journal"/>
    <statistic name="outstandingAIOs"   type="hilo32"  unit="aio_op" desc="Number of currently outstanding AIO requests in Async IO system"/>

<!--
    The following are not yet "wired up" in JournalImpl.cpp
-->
    <statistic name="freeFileCount"       type="hilo32"  unit="file"   desc="Number of files free on this journal. Includes free files trapped in holes."/>
    <statistic name="availableFileCount"  type="hilo32"  unit="file"   desc="Number of files available to be written.  Excluding holes"/>
    <statistic name="writeWaitFailures"   type="count64" unit="record" desc="AIO Wait failures on write"/>
    <statistic name="writeBusyFailures"   type="count64" unit="record" desc="AIO Busy failures on write"/>
    <statistic name="readRecordCount"     type="count64" unit="record" desc="Records read from the journal"/>
    <statistic name="readBusyFailures"    type="count64" unit="record" desc="AIO Busy failures on read"/>
    <statistic name="writePageCacheDepth" type="hilo32"  unit="wpage"  desc="Current depth of write-page-cache"/>
    <statistic name="readPageCacheDepth"  type="hilo32"  unit="rpage"  desc="Current depth of read-page-cache"/>

    <method name="expand" desc="Increase number of files allocated for this journal">
      <arg name="by" type="uint32" dir="I" desc="Number of files to increase journal size by"/>
    </method>
  </class>

  <eventArguments>
    <arg name="autoExpand" type="bool"   desc="Journal auto-expand enabled"/>
    <arg name="fileSize"   type="uint32" desc="Journal file size in bytes"/>
    <arg name="jrnlId"     type="sstr"   desc="Journal Id"/>
    <arg name="numEnq"     type="uint32" desc="Number of recovered enqueues"/>
    <arg name="numFiles"   type="uint16" desc="Number of journal files"/>
    <arg name="numTxn"     type="uint32" desc="Number of recovered transactions"/>
    <arg name="numTxnDeq"  type="uint32" desc="Number of recovered transactional dequeues"/>
    <arg name="numTxnEnq"  type="uint32" desc="Number of recovered transactional enqueues"/>
    <arg name="what"       type="sstr"   desc="Description of event"/>
  </eventArguments>
  <event name="enqThresholdExceeded" sev="warn"   args="jrnlId, what"/>
  <event name="created"              sev="notice" args="jrnlId, fileSize, numFiles"/>
  <event name="full"                 sev="error"  args="jrnlId, what"/>
  <event name="recovered"            sev="notice" args="jrnlId, fileSize, numFiles, numEnq, numTxn, numTxnEnq, numTxnDeq"/>
</schema>
