Skip to content

Commit

Permalink
proto format
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanchristo committed Mar 29, 2022
1 parent ded12c1 commit e478d12
Showing 1 changed file with 102 additions and 97 deletions.
199 changes: 102 additions & 97 deletions proto/regen/data/v1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,137 +8,142 @@ option go_package = "github.com/regen-network/regen-ledger/x/data";

// ContentHash specifies a hash-based content identifier for a piece of data.
message ContentHash {
// Raw specifies "raw" data which does not specify a deterministic, canonical encoding.
// Users of these hashes MUST maintain a copy of the hashed data which is preserved bit by bit.
// All other content encodings specify a deterministic, canonical encoding allowing implementations to
// choose from a variety of alternative formats for transport and encoding while maintaining the guarantee
// that the canonical hash will not change. The media type for "raw" data is defined by the MediaType enum.
Raw raw = 1;

// Graph specifies graph data that conforms to the RDF data model.
// The canonicalization algorithm used for an RDF graph is specified by GraphCanonicalizationAlgorithm.
Graph graph = 2;

// Raw is the content hash type used for raw data.
message Raw {
// hash represents the hash of the data based on the specified digest_algorithm.
bytes hash = 1;

// digest_algorithm represents the hash digest algorithm.
DigestAlgorithm digest_algorithm = 2;

// media_type represents the media type for raw data.
RawMediaType media_type = 3;

}

// Graph is the content hash type used for RDF graph data.
message Graph {
// hash represents the hash of the data based on the specified digest_algorithm.
bytes hash = 1;

// digest_algorithm represents the hash digest algorithm.
DigestAlgorithm digest_algorithm = 2;

// graph_canonicalization_algorithm represents the RDF graph canonicalization algorithm.
GraphCanonicalizationAlgorithm canonicalization_algorithm = 3;

// merkle_tree is the merkle tree type used for the graph hash, if any.
GraphMerkleTree merkle_tree = 4;
}
// Raw specifies "raw" data which does not specify a deterministic, canonical
// encoding. Users of these hashes MUST maintain a copy of the hashed data
// which is preserved bit by bit. All other content encodings specify a
// deterministic, canonical encoding allowing implementations to choose from a
// variety of alternative formats for transport and encoding while maintaining
// the guarantee that the canonical hash will not change. The media type for
// "raw" data is defined by the MediaType enum.
Raw raw = 1;

// Graph specifies graph data that conforms to the RDF data model.
// The canonicalization algorithm used for an RDF graph is specified by
// GraphCanonicalizationAlgorithm.
Graph graph = 2;

// Raw is the content hash type used for raw data.
message Raw {
// hash represents the hash of the data based on the specified
// digest_algorithm.
bytes hash = 1;

// digest_algorithm represents the hash digest algorithm.
DigestAlgorithm digest_algorithm = 2;

// media_type represents the media type for raw data.
RawMediaType media_type = 3;
}

// Graph is the content hash type used for RDF graph data.
message Graph {
// hash represents the hash of the data based on the specified
// digest_algorithm.
bytes hash = 1;

// digest_algorithm represents the hash digest algorithm.
DigestAlgorithm digest_algorithm = 2;

// graph_canonicalization_algorithm represents the RDF graph
// canonicalization algorithm.
GraphCanonicalizationAlgorithm canonicalization_algorithm = 3;

// merkle_tree is the merkle tree type used for the graph hash, if any.
GraphMerkleTree merkle_tree = 4;
}
}

// DigestAlgorithm is the hash digest algorithm
enum DigestAlgorithm {
// unspecified and invalid
DIGEST_ALGORITHM_UNSPECIFIED = 0;
// unspecified and invalid
DIGEST_ALGORITHM_UNSPECIFIED = 0;

// BLAKE2b-256
DIGEST_ALGORITHM_BLAKE2B_256 = 1;
// BLAKE2b-256
DIGEST_ALGORITHM_BLAKE2B_256 = 1;
}

// RawMediaType defines MIME media types to be used with a ContentHash.Raw hash.
enum RawMediaType {
// RAW_MEDIA_TYPE_UNSPECIFIED can be used for raw binary data
RAW_MEDIA_TYPE_UNSPECIFIED = 0;
// RAW_MEDIA_TYPE_UNSPECIFIED can be used for raw binary data
RAW_MEDIA_TYPE_UNSPECIFIED = 0;

// basic formats
// basic formats

// plain text
RAW_MEDIA_TYPE_TEXT_PLAIN = 1;
// plain text
RAW_MEDIA_TYPE_TEXT_PLAIN = 1;

// JSON
RAW_MEDIA_TYPE_JSON = 2;
// JSON
RAW_MEDIA_TYPE_JSON = 2;

// CSV
RAW_MEDIA_TYPE_CSV = 3;
// CSV
RAW_MEDIA_TYPE_CSV = 3;

// XML
RAW_MEDIA_TYPE_XML = 4;
// XML
RAW_MEDIA_TYPE_XML = 4;

// PDF
RAW_MEDIA_TYPE_PDF = 5;
// PDF
RAW_MEDIA_TYPE_PDF = 5;

// images
// images

// TIIF
RAW_MEDIA_TYPE_TIFF = 16;
// TIIF
RAW_MEDIA_TYPE_TIFF = 16;

// JPG
RAW_MEDIA_TYPE_JPG = 17;
// JPG
RAW_MEDIA_TYPE_JPG = 17;

// PNG
RAW_MEDIA_TYPE_PNG = 18;
// PNG
RAW_MEDIA_TYPE_PNG = 18;

// SVG
RAW_MEDIA_TYPE_SVG = 19;
// SVG
RAW_MEDIA_TYPE_SVG = 19;

// WEBP
RAW_MEDIA_TYPE_WEBP = 20;
// WEBP
RAW_MEDIA_TYPE_WEBP = 20;

// AVIF
RAW_MEDIA_TYPE_AVIF = 21;
// AVIF
RAW_MEDIA_TYPE_AVIF = 21;

// GIF
RAW_MEDIA_TYPE_GIF = 22;
// GIF
RAW_MEDIA_TYPE_GIF = 22;

// APNG
RAW_MEDIA_TYPE_APNG = 23;
// APNG
RAW_MEDIA_TYPE_APNG = 23;

// audio-visual media containers
// audio-visual media containers

// MPEG
RAW_MEDIA_TYPE_MPEG = 32;
// MPEG
RAW_MEDIA_TYPE_MPEG = 32;

// MP4
RAW_MEDIA_TYPE_MP4 = 33;
// MP4
RAW_MEDIA_TYPE_MP4 = 33;

// WEBM
RAW_MEDIA_TYPE_WEBM = 34;
// WEBM
RAW_MEDIA_TYPE_WEBM = 34;

// OGG
RAW_MEDIA_TYPE_OGG = 35;
// OGG
RAW_MEDIA_TYPE_OGG = 35;

// geospatial raster formats
// TODO
// geospatial raster formats
// TODO

// geospatial vector formats
// TODO
// geospatial vector formats
// TODO
}

// GraphCanonicalizationAlgorithm is the graph canonicalization algorithm
enum GraphCanonicalizationAlgorithm {
// unspecified and invalid
GRAPH_CANONICALIZATION_ALGORITHM_UNSPECIFIED = 0;
// unspecified and invalid
GRAPH_CANONICALIZATION_ALGORITHM_UNSPECIFIED = 0;

// URDNA2015 graph hashing
GRAPH_CANONICALIZATION_ALGORITHM_URDNA2015 = 1;
// URDNA2015 graph hashing
GRAPH_CANONICALIZATION_ALGORITHM_URDNA2015 = 1;
}

// GraphMerkleTree is the graph merkle tree type used for hashing, if any
enum GraphMerkleTree {
// no merkle tree
GRAPH_MERKLE_TREE_NONE_UNSPECIFIED = 0;
// no merkle tree
GRAPH_MERKLE_TREE_NONE_UNSPECIFIED = 0;
}

// ContentEntry describes data referenced and possibly stored on chain
Expand All @@ -155,15 +160,15 @@ message ContentEntry {

// AttestorEntry is a attestor entry wrapping a attestor address and timestamp
message AttestorEntry {
// attestor is the address of the attestor.
string attestor = 1;
// attestor is the address of the attestor.
string attestor = 1;

// timestamp is the Timestamp of the attestation.
google.protobuf.Timestamp timestamp = 2;
// timestamp is the Timestamp of the attestation.
google.protobuf.Timestamp timestamp = 2;
}

// ContentHashes contains list of content ContentHash.
message ContentHashes {
// data is a list of content hashes which the resolver claims to serve.
repeated ContentHash data = 1;
// data is a list of content hashes which the resolver claims to serve.
repeated ContentHash data = 1;
}

0 comments on commit e478d12

Please sign in to comment.