-
Notifications
You must be signed in to change notification settings - Fork 178
/
headers.go
36 lines (26 loc) · 1.2 KB
/
headers.go
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
// (c) 2019 Dapper Labs - ALL RIGHTS RESERVED
package storage
import (
"github.com/onflow/flow-go/model/flow"
)
// Headers represents persistent storage for blocks.
type Headers interface {
// Store will store a header.
Store(header *flow.Header) error
// ByBlockID returns the header with the given ID. It is available for
// finalized and ambiguous blocks.
ByBlockID(blockID flow.Identifier) (*flow.Header, error)
// ByHeight returns the block with the given number. It is only available
// for finalized blocks.
ByHeight(height uint64) (*flow.Header, error)
// ByParentID finds all children for the given parent block. The returned headers
// might be unfinalized; if there is more than one, at least one of them has to
// be unfinalized.
ByParentID(parentID flow.Identifier) ([]*flow.Header, error)
// IndexByChunkID indexes block ID by chunk ID.
IndexByChunkID(headerID, chunkID flow.Identifier) error
// BatchIndexByChunkID indexes block ID by chunk ID in a given batch.
BatchIndexByChunkID(headerID, chunkID flow.Identifier, batch BatchStorage) error
// IDByChunkID finds the ID of the block corresponding to given chunk ID.
IDByChunkID(chunkID flow.Identifier) (flow.Identifier, error)
}