-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathIDataBlock.cs
63 lines (55 loc) · 1.58 KB
/
IDataBlock.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using Google.Protobuf;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ipfs
{
/// <summary>
/// Some data that is stored in IPFS.
/// </summary>
/// <remarks>
/// A <b>DataBlock</b> has an <see cref="Id">unique ID</see>
/// and some data (<see cref="IDataBlock.DataBytes"/>
/// or <see cref="IDataBlock.DataStream"/>).
/// <para>
/// It is useful to talk about them as "blocks" in Bitswap
/// and other things that do not care about what is being stored.
/// </para>
/// </remarks>
/// <seealso cref="IMerkleNode{Link}"/>
public interface IDataBlock
{
/// <summary>
/// Contents as a byte array.
/// </summary>
/// <remarks>
/// It is never <b>null</b>.
/// </remarks>
/// <value>
/// The contents as a sequence of bytes.
/// </value>
byte[] DataBytes { get; }
/// <summary>
/// Contents as a stream of bytes.
/// </summary>
/// <value>
/// The contents as a stream of bytes.
/// </value>
Stream DataStream { get; }
/// <summary>
/// The unique ID of the data.
/// </summary>
/// <value>
/// A <see cref="Cid"/> of the content.
/// </value>
Cid Id { get; }
/// <summary>
/// The size (in bytes) of the data.
/// </summary>
/// <value>Number of bytes.</value>
long Size { get; }
}
}