-
Notifications
You must be signed in to change notification settings - Fork 0
/
drivers.go
47 lines (39 loc) · 1.29 KB
/
drivers.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
37
38
39
40
41
42
43
44
45
46
47
package engineio
import (
"encoding/json"
"fmt"
"github.com/sarvalabs/go-polo"
)
// EnvDriver represents a driver for environmental information.
// It describes information about the execution context such
// as the consensus cluster ID or execution timestamp.
type EnvDriver interface {
Timestamp() int64
ClusterID() string
}
// DependencyDriver represents an interface for an engine's element dependency manager.
//
// It must be expressible as a string and encodable with JSON and POLO.
// It manages the dependency relationship between element pointers with
// the pointers being vertices and their relationship being directional edges.
type DependencyDriver interface {
fmt.Stringer
json.Marshaler
json.Unmarshaler
polo.Polorizable
polo.Depolorizable
Insert(uint64, ...uint64)
Remove(uint64)
Size() uint64
Iter() <-chan uint64
Contains(uint64) bool
Edges(uint64) []uint64
Dependencies(uint64) []uint64
}
// CryptoDriver represents an interface for cryptographic operations.
// It can be used to validate signature formats and verify them for a public key.
// This interfaces allows us to pass the capabilities of go-moi's crypto package to different engine runtimes.
type CryptoDriver interface {
ValidateSignature(sig []byte) bool
VerifySignature(data, sig, pub []byte) (bool, error)
}