##
## Copyright (C) by Argonne National Laboratory
##     See COPYRIGHT in top-level directory
##
#
# PMI version 1.1 message protocol
#
# FORMAT:
#     [Refer to the "INIT" message exchange below]
#
#     Each message exchange has a capitalized name, e.g. INIT. It is used to
#     track Compatibilities between PMI versions. The exchange consists of a
#     client query and a server reply. Each query or reply contains zero or
#     more attributes. For example, INIT using PMI-1 wire protocol, client
#     send query:
#         cmd=init pmi_version=1 pmi_subversion=1
#     , and the server reply:
#         cmd=response_to_init version=1 pmi_subversion=1
#          
#     Each attribute specifies a type and zero or more annotations indicating
#     e.g. when it is optional and the default value when it is missing. All
#     optional attributes should be listed after any mandatory attributes.
#
#     The query or reply may also require specific wire protocol. For example,
#     "Q: spawn, wire=v1-mcmd" indicate the query should be in the "v1-mcmd"
#     wire format.
#
#     The server reply may include an "rc: INTEGER" and "msg: STRING"
#     attributes to indicate an error. When a non-zero rc is returned, the
#     normal attributes may not be included.
#
# Default wire protocol: v1
#


INIT:
    Q: init
        pmi_version: INTEGER
        pmi_subversion: INTEGER
    R: response_to_init
        pmi_version: INTEGER
        pmi_subversion: INTEGER

FULLINIT:
    Q: initack
        pmiid: INTEGER
    R: initack, wire=v1-initack
        rank: INTEGER
        size: INTEGER
        appnum: INTEGER, optional=-1
        spawner-jobid: STRING, optional=NULL
        debug: INTEGER

FINALIZE:
    Q: finalize
    R: finalize_ack

ABORT:
    Q: abort
        exitcode: INTEGER, optional=1
        message: STRING, optional=NULL

MAXES:
    Q: get_maxes
    R: maxes
        kvsname_max: INTEGER
        keylen_max: INTEGER
        vallen_max: INTEGER

UNIVERSE:
    Q: get_universe_size
    R: universe_size
        size: INTEGER

APPNUM:
    Q: get_appnum
    R: appnum
        appnum: INTEGER

KVSNAME:
    Q: get_my_kvsname
    R: my_kvsname
        kvsname: STRING

PUT:
    Q: put
        kvsname: STRING, optional=NULL
        key: STRING
        value: STRING
    R: put_result

GET:
    Q: get
        kvsname: STRING, optional=NULL
        key: STRING
    R: get_result
        value: STRING
        found: BOOLEAN, optional=true

BARRIER:
    Q: barrier_in
    R: barrier_out

PUBLISH:
    Q: publish_name
        service: STRING
        port: STRING
    R: publish_result

UNPUBLISH:
    Q: unpublish_name
        service: STRING
    R: unpublish_result

LOOKUP:
    Q: lookup_name
        service: STRING
    R: lookup_result
        port: STRING

SPAWN:
    Q: spawn, wire=v1-mcmd
        totspawns: INTEGER
        preput_num: INTEGER, optional=0
        preput_key_#: STRING, count=preput_num, base=0
        preput_val_#: STRING, count=preput_num, base=0
        [
        execname: STRING
        nprocs: INTEGER
        argcnt: INTEGER
        infonum: INTEGER, optional=0
        arg#: STRING, count=argcnt, base=1
        info_key_#: STRING, count=infonum, base=0
        info_val_#: STRING, count=infonum, base=0
        ]
    R: spawn_result

SINGINIT:
    Q: singinit
        pmi_version: INTEGER
        pmi_subversion: INTEGER
        stdio: STRING, optional="yes"
        authtype: STRING, optional="none"
    R: singinit_info
        versionok: STRING
        stdio: STRING, optional="yes"
        kvsname: STRING

# server to proxy query
MPUT:
    Q: mput
KVSCACHE:
    Q: keyval_cache
BARRIEROUT:
    Q: barrier_out
