@cryptotaxi247 / kubo / commits / 361534129

corapi: block docs

License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com> This commit was moved from ipfs/interface-go-ipfs-core@1ffde91c6cc373e97ed28eb80ad3fb9ddf5103e1 This commit was moved from ipfs/boxo@db1f6da007f8c3d45668459b81d4b99559b0cea7

Łukasz Magiera committed Jan 6, 2018 at 17:13 UTC 3615341299acfa25c0061a7afaf60339dc596913
1 file changed +19
core/coreiface/interface.go
+19
@@ -94,16 +94,35 @@ type UnixfsAPI interface {
94 Ls(context.Context, Path) ([]*Link, error)
95 }
96
97 +// BlockAPI specifies the interface to the block layer
98 type BlockAPI interface {
99 + // Put imports raw block data, hashing it using specified settings.
100 Put(context.Context, io.Reader, ...options.BlockPutOption) (Path, error)
101 +
102 + // WithFormat is an option for Put which specifies the multicodec to use to
103 + // serialize the object. Default is "v0"
104 WithFormat(codec string) options.BlockPutOption
105 +
106 + // WithHash is an option for Put which specifies the multihash settings to use
107 + // when hashing the object. Default is mh.SHA2_256 (0x12).
108 + // If mhLen is set to -1, default length for the hash will be used
109 WithHash(mhType uint64, mhLen int) options.BlockPutOption
110
111 + // Get attempts to resolve the path and return a reader for data in the block
112 Get(context.Context, Path) (io.Reader, error)
113
114 + // Rm removes the block specified by the path from local blockstore.
115 + // By default an error will be returned if the block can't be found locally.
116 + //
117 + // NOTE: If the specified block is pinned it won't be removed and no error
118 + // will be returned
119 Rm(context.Context, Path, ...options.BlockRmOption) error
120 +
121 + // WithForce is an option for Rm which, when set to true, will ignore
122 + // non-existing blocks
123 WithForce(force bool) options.BlockRmOption
124
125 + // Stat returns information on
126 Stat(context.Context, Path) (BlockStat, error)
127 }
128