...
1 package memory
2
3 import "github.com/pkg/errors"
4
5 type classType uint32
6
7 const (
8 MiB = 1024 * 1024
9 GiB = 1024 * MiB
10 )
11
12 var (
13 ErrNotEnoughSpace = errors.New("not enough space")
14 ErrNotAllocated = errors.New("no memory allocated at the given offset")
15 )
16
17
18 type MappedRegion interface {
19 Offset() uint64
20 Size() uint64
21 Type() classType
22 }
23
24
25 type Allocator interface {
26 Allocate(uint64) (MappedRegion, error)
27 Release(MappedRegion) error
28 }
29
View as plain text