mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
render schema/vote.rst
This commit is contained in:
parent
31be5b3c8a
commit
b227739d89
@ -7,6 +7,10 @@ title: Vote Schema
|
|||||||
description: |
|
description: |
|
||||||
A Vote is an endorsement of a Block (identified by a hash) by
|
A Vote is an endorsement of a Block (identified by a hash) by
|
||||||
a node (identified by a public key).
|
a node (identified by a public key).
|
||||||
|
|
||||||
|
The outer Vote object contains the details of the vote being made
|
||||||
|
as well as the signature and identifying information of the node
|
||||||
|
passing the vote.
|
||||||
required:
|
required:
|
||||||
- node_pubkey
|
- node_pubkey
|
||||||
- signature
|
- signature
|
||||||
@ -34,16 +38,6 @@ properties:
|
|||||||
- voting_for_block
|
- voting_for_block
|
||||||
- timestamp
|
- timestamp
|
||||||
properties:
|
properties:
|
||||||
invalid_reason:
|
|
||||||
anyOf:
|
|
||||||
- type: "string"
|
|
||||||
description: |
|
|
||||||
Reason the block is voted invalid, or ``null``.
|
|
||||||
- type: "null"
|
|
||||||
is_block_valid:
|
|
||||||
type: "boolean"
|
|
||||||
description: |
|
|
||||||
This field is ``true`` if the block was deemed valid by the node.
|
|
||||||
previous_block:
|
previous_block:
|
||||||
"$ref": "#/definitions/sha3_hexdigest"
|
"$ref": "#/definitions/sha3_hexdigest"
|
||||||
description: |
|
description: |
|
||||||
@ -53,6 +47,16 @@ properties:
|
|||||||
"$ref": "#/definitions/sha3_hexdigest"
|
"$ref": "#/definitions/sha3_hexdigest"
|
||||||
description: |
|
description: |
|
||||||
Sha3 identifier of the block being voted on.
|
Sha3 identifier of the block being voted on.
|
||||||
|
is_block_valid:
|
||||||
|
type: "boolean"
|
||||||
|
description: |
|
||||||
|
This field is ``true`` if the block was deemed valid by the node.
|
||||||
|
invalid_reason:
|
||||||
|
anyOf:
|
||||||
|
- type: "string"
|
||||||
|
description: |
|
||||||
|
Reason the block is voted invalid, or ``null``.
|
||||||
|
- type: "null"
|
||||||
timestamp:
|
timestamp:
|
||||||
type: "string"
|
type: "string"
|
||||||
pattern: "[0-9]{10}"
|
pattern: "[0-9]{10}"
|
||||||
|
@ -5,7 +5,7 @@ import os.path
|
|||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from bigchaindb.common.schema import TX_SCHEMA_PATH
|
from bigchaindb.common.schema import TX_SCHEMA_PATH, VOTE_SCHEMA_PATH
|
||||||
|
|
||||||
|
|
||||||
TPL_PROP = """\
|
TPL_PROP = """\
|
||||||
@ -84,6 +84,23 @@ Metadata
|
|||||||
""" + TPL_STYLES
|
""" + TPL_STYLES
|
||||||
|
|
||||||
|
|
||||||
|
def generate_transaction_docs():
|
||||||
|
schema = load_schema(TX_SCHEMA_PATH)
|
||||||
|
defs = schema['definitions']
|
||||||
|
|
||||||
|
doc = TPL_TRANSACTION % {
|
||||||
|
'transaction': render_section('Transaction', schema),
|
||||||
|
'condition': render_section('Condition', defs['condition']),
|
||||||
|
'fulfillment': render_section('Fulfillment', defs['fulfillment']),
|
||||||
|
'asset': render_section('Asset', defs['asset']),
|
||||||
|
'metadata': render_section('Metadata', defs['metadata']['anyOf'][0]),
|
||||||
|
'container': 'transaction-schema',
|
||||||
|
'file': os.path.basename(__file__),
|
||||||
|
}
|
||||||
|
|
||||||
|
write_schema_doc('transaction', doc)
|
||||||
|
|
||||||
|
|
||||||
TPL_VOTE = """\
|
TPL_VOTE = """\
|
||||||
.. This file was auto generated by %(file)s
|
.. This file was auto generated by %(file)s
|
||||||
|
|
||||||
@ -91,9 +108,32 @@ TPL_VOTE = """\
|
|||||||
Vote Schema
|
Vote Schema
|
||||||
===========
|
===========
|
||||||
|
|
||||||
|
Vote
|
||||||
|
----
|
||||||
|
|
||||||
|
%(vote)s
|
||||||
|
|
||||||
|
Vote Details
|
||||||
|
------------
|
||||||
|
|
||||||
|
%(vote_details)s
|
||||||
|
|
||||||
""" + TPL_STYLES
|
""" + TPL_STYLES
|
||||||
|
|
||||||
|
|
||||||
|
def generate_vote_docs():
|
||||||
|
schema = load_schema(VOTE_SCHEMA_PATH)
|
||||||
|
|
||||||
|
doc = TPL_VOTE % {
|
||||||
|
'vote': render_section('Vote', schema),
|
||||||
|
'vote_details': render_section('Vote', schema['properties']['vote']),
|
||||||
|
'container': 'vote-schema',
|
||||||
|
'file': os.path.basename(__file__),
|
||||||
|
}
|
||||||
|
|
||||||
|
write_schema_doc('vote', doc)
|
||||||
|
|
||||||
|
|
||||||
def ordered_load_yaml(path):
|
def ordered_load_yaml(path):
|
||||||
""" Custom YAML loader to preserve key order """
|
""" Custom YAML loader to preserve key order """
|
||||||
class OrderedLoader(yaml.SafeLoader):
|
class OrderedLoader(yaml.SafeLoader):
|
||||||
@ -116,23 +156,6 @@ def load_schema(path):
|
|||||||
return schema
|
return schema
|
||||||
|
|
||||||
|
|
||||||
def generate_transaction_docs():
|
|
||||||
schema = load_schema(TX_SCHEMA_PATH)
|
|
||||||
defs = schema['definitions']
|
|
||||||
|
|
||||||
doc = TPL_TRANSACTION % {
|
|
||||||
'transaction': render_section('Transaction', schema),
|
|
||||||
'condition': render_section('Condition', defs['condition']),
|
|
||||||
'fulfillment': render_section('Fulfillment', defs['fulfillment']),
|
|
||||||
'asset': render_section('Asset', defs['asset']),
|
|
||||||
'metadata': render_section('Metadata', defs['metadata']['anyOf'][0]),
|
|
||||||
'container': 'transaction-schema',
|
|
||||||
'file': os.path.basename(__file__),
|
|
||||||
}
|
|
||||||
|
|
||||||
write_schema_doc('transaction', doc)
|
|
||||||
|
|
||||||
|
|
||||||
def write_schema_doc(name, doc):
|
def write_schema_doc(name, doc):
|
||||||
# Check base path exists
|
# Check base path exists
|
||||||
base_path = os.path.join(os.path.dirname(__file__), 'source/schema')
|
base_path = os.path.join(os.path.dirname(__file__), 'source/schema')
|
||||||
@ -197,6 +220,7 @@ def resolve_ref(ref):
|
|||||||
def main():
|
def main():
|
||||||
""" Main function """
|
""" Main function """
|
||||||
generate_transaction_docs()
|
generate_transaction_docs()
|
||||||
|
generate_vote_docs()
|
||||||
|
|
||||||
|
|
||||||
def setup(*_):
|
def setup(*_):
|
||||||
|
@ -16,5 +16,6 @@ BigchainDB Server Documentation
|
|||||||
topic-guides/index
|
topic-guides/index
|
||||||
data-models/index
|
data-models/index
|
||||||
schema/transaction
|
schema/transaction
|
||||||
|
schema/vote
|
||||||
release-notes
|
release-notes
|
||||||
appendices/index
|
appendices/index
|
||||||
|
118
docs/server/source/schema/vote.rst
Normal file
118
docs/server/source/schema/vote.rst
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
.. This file was auto generated by generate_schema_documentation.py
|
||||||
|
|
||||||
|
===========
|
||||||
|
Vote Schema
|
||||||
|
===========
|
||||||
|
|
||||||
|
Vote
|
||||||
|
----
|
||||||
|
|
||||||
|
A Vote is an endorsement of a Block (identified by a hash) by
|
||||||
|
a node (identified by a public key).
|
||||||
|
|
||||||
|
The outer Vote object contains the details of the vote being made
|
||||||
|
as well as the signature and identifying information of the node
|
||||||
|
passing the vote.
|
||||||
|
|
||||||
|
|
||||||
|
Vote.node_pubkey
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
**type:** string
|
||||||
|
|
||||||
|
Ed25519 public key identifying the voting node.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Vote.signature
|
||||||
|
^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
**type:** string
|
||||||
|
|
||||||
|
Ed25519 signature of the ``vote`` object.
|
||||||
|
|
||||||
|
|
||||||
|
Vote.vote
|
||||||
|
^^^^^^^^^
|
||||||
|
|
||||||
|
**type:** object
|
||||||
|
|
||||||
|
Vote details to be signed.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Vote Details
|
||||||
|
------------
|
||||||
|
|
||||||
|
Vote details to be signed.
|
||||||
|
|
||||||
|
|
||||||
|
Vote.previous_block
|
||||||
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
**type:** string
|
||||||
|
|
||||||
|
Sha3 identifier of the block that preceeds the block being voted on.
|
||||||
|
The notion of a "previous" block is subject to vote.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Vote.voting_for_block
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
**type:** string
|
||||||
|
|
||||||
|
Sha3 identifier of the block being voted on.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Vote.is_block_valid
|
||||||
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
**type:** boolean
|
||||||
|
|
||||||
|
This field is ``true`` if the block was deemed valid by the node.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Vote.invalid_reason
|
||||||
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
**type:** string or null
|
||||||
|
|
||||||
|
Reason the block is voted invalid, or ``null``.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Vote.timestamp
|
||||||
|
^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
**type:** string
|
||||||
|
|
||||||
|
Unix timestamp that the vote was created by the node, according
|
||||||
|
to the system time of the node.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
|
||||||
|
<style>
|
||||||
|
#vote-schema h2 {
|
||||||
|
border-top: solid 3px #6ab0de;
|
||||||
|
background-color: #e7f2fa;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
#vote-schema h3 {
|
||||||
|
background: #f0f0f0;
|
||||||
|
border-left: solid 3px #ccc;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 6px;
|
||||||
|
font-size: 100%;
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
x
Reference in New Issue
Block a user