Skip to content

Commit

Permalink
refine comments
Browse files Browse the repository at this point in the history
  • Loading branch information
postables committed Mar 27, 2020
1 parent a64fa2a commit a12d9a9
Show file tree
Hide file tree
Showing 7 changed files with 842 additions and 681 deletions.
10 changes: 8 additions & 2 deletions doc/PROTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ NameSysAPI provides a generic name resolution API
| ----- | ---- | ----- | ----------- |
| cid | [string](#string) | | cid is the identifier of the block |
| data | [bytes](#bytes) | | data is the actual contents of the block |
| size | [int64](#int64) | | size of the block, only filled out by BS_GET_STATS since if we just want stats, we dont want to retrieve all teh data. |



Expand All @@ -495,7 +496,7 @@ BlockstoreRequest is a message used to control blockstores
| ----- | ---- | ----- | ----------- |
| requestType | [BSREQTYPE](#pb.BSREQTYPE) | | indicates the particular request type being made |
| reqOpts | [BSREQOPTS](#pb.BSREQOPTS) | repeated | optional request settings |
| cids | [string](#string) | repeated | cids of blocks sent by: BS_DELETE, BS_GET, BS_GET_MANY |
| cids | [string](#string) | repeated | cids of blocks sent by: BS_DELETE, BS_GET, BS_GET_MANY, BS_GET_STATS |
| data | [bytes](#bytes) | repeated | the data we are putting sent by: BS_PUT, BS_PUT_MANY |
| cidVersion | [string](#string) | | the cid version to use when constructing blocks, default is v1 sent by: BS_PUT, BS_PUT_MANY |
| hashFunc | [string](#string) | | the hash function to use when constructing blocks, default is sha2-256 sent by: BS_PUT, BS_PUT_MANY |
Expand All @@ -514,7 +515,11 @@ BlockstoreResponse is a response to a BlockstoreqRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| requestType | [BSREQTYPE](#pb.BSREQTYPE) | | indicates the particular request type being made |
| blocks | [Block](#pb.Block) | repeated | a copy of blocks from the blockstore sent by: BS_PUT, BS_PUT_MANY, BS_GET, BS_GET_MANY in the case of BS_PUT, and BS_PUT_MANY requests the data field will be empty as this is only populated by get requests |
| blocks | [Block](#pb.Block) | repeated | a copy of blocks from the blockstore sent by: BS_PUT, BS_PUT_MANY, BS_GET, BS_GET_MANY, BS_GET_STATS, BS_GET_ALL

in the case of BS_PUT, and BS_PUT_MANY requests the data field will be empty as this is only populated by get requests

in the case of BS_GET_STATS only the cid, and size params will be filled out, since we are just interested in the size |



Expand Down Expand Up @@ -908,6 +913,7 @@ BSREQTYPE is a particular blockstore request type
| BS_GET | 3 | BS_GET is used to get a block from the store |
| BS_GET_MANY | 4 | BS_GET_MANY is used to get many blocks from the store |
| BS_GET_ALL | 5 | BS_GET_ALL is used to retrieve all blocks from the store It is the gRPC equivalent of Blockstore::AllKeysChan |
| BS_GET_STATS | 6 | BS_GET_STATS is used to retrieve statistics about individual blocks |



Expand Down
257 changes: 152 additions & 105 deletions go/node.pb.go

Large diffs are not rendered by default.

32 changes: 30 additions & 2 deletions js/node_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -2468,7 +2468,8 @@ proto.pb.Block.prototype.toObject = function(opt_includeInstance) {
proto.pb.Block.toObject = function(includeInstance, msg) {
var f, obj = {
cid: jspb.Message.getFieldWithDefault(msg, 1, ""),
data: msg.getData_asB64()
data: msg.getData_asB64(),
size: jspb.Message.getFieldWithDefault(msg, 3, 0)
};

if (includeInstance) {
Expand Down Expand Up @@ -2513,6 +2514,10 @@ proto.pb.Block.deserializeBinaryFromReader = function(msg, reader) {
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setData(value);
break;
case 3:
var value = /** @type {number} */ (reader.readInt64());
msg.setSize(value);
break;
default:
reader.skipField();
break;
Expand Down Expand Up @@ -2556,6 +2561,13 @@ proto.pb.Block.serializeBinaryToWriter = function(message, writer) {
f
);
}
f = message.getSize();
if (f !== 0) {
writer.writeInt64(
3,
f
);
}
};


Expand Down Expand Up @@ -2613,6 +2625,21 @@ proto.pb.Block.prototype.setData = function(value) {
};


/**
* optional int64 size = 3;
* @return {number}
*/
proto.pb.Block.prototype.getSize = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};


/** @param {number} value */
proto.pb.Block.prototype.setSize = function(value) {
jspb.Message.setProto3IntField(this, 3, value);
};



/**
* Generated by JsPbCodeGenerator.
Expand Down Expand Up @@ -4569,7 +4596,8 @@ proto.pb.BSREQTYPE = {
BS_PUT_MANY: 2,
BS_GET: 3,
BS_GET_MANY: 4,
BS_GET_ALL: 5
BS_GET_ALL: 5,
BS_GET_STATS: 6
};

/**
Expand Down
14 changes: 12 additions & 2 deletions pb/node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ enum BSREQTYPE {
// BS_GET_ALL is used to retrieve all blocks from the store
// It is the gRPC equivalent of Blockstore::AllKeysChan
BS_GET_ALL = 5;
// BS_GET_STATS is used to retrieve statistics about individual blocks
BS_GET_STATS = 6;
}

// BSREQOPTS are options for blockstore requests
Expand All @@ -189,7 +191,7 @@ message BlockstoreRequest {
// optional request settings
repeated BSREQOPTS reqOpts = 2;
// cids of blocks
// sent by: BS_DELETE, BS_GET, BS_GET_MANY
// sent by: BS_DELETE, BS_GET, BS_GET_MANY, BS_GET_STATS
repeated string cids = 3;
// the data we are putting
// sent by: BS_PUT, BS_PUT_MANY
Expand All @@ -207,10 +209,14 @@ message BlockstoreResponse {
// indicates the particular request type being made
BSREQTYPE requestType = 1;
// a copy of blocks from the blockstore
// sent by: BS_PUT, BS_PUT_MANY, BS_GET, BS_GET_MANY
// sent by: BS_PUT, BS_PUT_MANY, BS_GET, BS_GET_MANY, BS_GET_STATS, BS_GET_ALL
//
// in the case of BS_PUT, and BS_PUT_MANY requests
// the data field will be empty as this is only populated
// by get requests
//
// in the case of BS_GET_STATS only the cid, and size params
// will be filled out, since we are just interested in the size
repeated Block blocks = 2;
}

Expand All @@ -219,6 +225,10 @@ message Block {
string cid = 1;
// data is the actual contents of the block
bytes data = 2;
// size of the block, only filled out by BS_GET_STATS
// since if we just want stats, we dont want to
// retrieve all teh data.
int64 size = 3;
}

// DAGREQTYPE indicates the particular DagAPI request being performed
Expand Down
Loading

0 comments on commit a12d9a9

Please sign in to comment.