Skip to content

Commit

Permalink
make linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
aschmahmann committed Aug 26, 2022
1 parent 661ab5b commit add1c6a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions BITSWAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ Given that a client C wants to fetch data from some server S:
1. If C sends S a Have request for data S has (and is willing to give to C) it should respond with a Have, although it may instead respond with the block itself (e.g. if the block is very small)
1. For each of the items that S sends back Blocks or BlockPresences for they may append any `tokens` they want
2. If C sends S a Have request for data S has but is not currently willing to give to C, S may respond with an `AuthRequired` BlockPresence
1. For each of the items that S sends back Blocks or BlockPresences for they may append any `tokens` they want. Recommended tokens include those that would inform C how they could convince S to give them access to the blocks they want.
2. If C sends S a Have request for data S does not have (or has but is not willing to tell C it has) and C has requested for DontHave responses then S should respond with DontHave
3. S may choose to include the number of bytes that are pending to be sent to C in the response message
4. If C asked for a block that S has but it is bigger than the maximum block size it should return `BlockTooBig`
1. For each of the items that S sends back Blocks or BlockPresences for they may append any `tokens` they want. Recommended tokens include those that would inform C how they could convince S to give them access to the blocks they want.
2. If C sends S a Have request for data S does not have (or has but is not willing to tell C it has) and C has requested for DontHave responses then S should respond with DontHave
3. S may choose to include the number of bytes that are pending to be sent to C in the response message
4. If C asked for a block that S has but it is bigger than the maximum block size it should return `BlockTooBig`
3. When C no longer needs a block it previously asked for it should send a Cancel message for that request to any peers that have not already responded about that particular block. It should particularly send Cancel messages for Block requests (as opposed to Have requests) that have not yet been answered.

### Tokens
Expand All @@ -228,13 +228,13 @@ The major change in this protocol version is the introduction of the ability to
Users who require additional codes for their new token formats should do one of:
- Register their code in the table
- For non-deployed testing purposes only - use a code in the application reserved range of the code table
- Note: if codes in the application reserved range will not be reservable in the code table which means that the code may conflict with another one used in the ecosystem which could cause application problems on collision. It is high recommended to not use these codes outside of testing or early development.
- Note: if codes in the application reserved range will not be reservable in the code table which means that the code may conflict with another one used in the ecosystem which could cause application problems on collision. It is high recommended to not use these codes outside of testing or early development.

To save space within the message the list of tokens used within the message are declared within the top level message and all other references to tokens are instead to the indices within the token list in the top level message.

### Wire Format

```
```protobuf
message Message {
message Wantlist {
Expand All @@ -245,14 +245,14 @@ message Message {
message Entry {
bytes block = 1; // CID of the block
int32 priority = 2; // the priority (normalized). default to 1
int32 priority = 2; // the priority (normalized). default to 1
bool cancel = 3; // whether this revokes an entry
WantType wantType = 4; // Note: defaults to enum 0, ie Block
bool sendDontHave = 5; // Note: defaults to false
repeated tokens int32 = 7; // the indices of the tokens in the token list
}
}
repeated Entry entries = 1; // a list of wantlist entries
repeated Entry entries = 1; // a list of wantlist entries
bool full = 2; // whether this is the full wantlist. default to false
}
message Block {
Expand Down Expand Up @@ -281,7 +281,7 @@ message Message {
}
```

# Implementations
## Implementations

- <https://github.com/ipfs/go-bitswap>
- <https://github.com/ipfs/js-ipfs-bitswap>

0 comments on commit add1c6a

Please sign in to comment.