We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e82c533 commit 0bd1b92Copy full SHA for 0bd1b92
blocks.go
@@ -16,12 +16,22 @@ import (
16
// according to the contents. It is currently used only when debugging.
17
var ErrWrongHash = errors.New("data did not match given hash")
18
19
+// Interface provides abstraction for blocks implementations.
20
+type Interface interface {
21
+ RawData() []byte
22
+ Cid() cid.Cid
23
+ String() string
24
+ Loggable() map[string]interface{}
25
+}
26
+
27
// A Block is a singular block of data in ipfs. This is some bytes addressed by a hash.
28
type Block struct {
29
cid cid.Cid
30
data []byte
31
}
32
33
+var _ Interface = Block{}
34
35
// NewBlock creates a Block object from opaque data. It will hash the data.
36
func NewBlock(data []byte) Block {
37
// TODO: fix assumptions
0 commit comments