-
Notifications
You must be signed in to change notification settings - Fork 1
/
permissionLayer_NON.go
65 lines (48 loc) · 1.47 KB
/
permissionLayer_NON.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package dht_permission_layers
import (
"time"
permLayer "github.com/archoncloud/archon-dht/permission_layer"
"github.com/libp2p/go-libp2p-core/peer"
)
const updateSPProfileInterval time.Duration = 30 * time.Minute
// NONPERMISSIONED
type NonPermissioned struct {
}
func (n NonPermissioned) ID() permLayer.PermissionLayerID {
return permLayer.NotPermissionId
}
func (n NonPermissioned) Permissioned() bool {
return false
}
func (n NonPermissioned) ValidatePeersPtrArr(bootstrapPeers []*peer.AddrInfo, timeout time.Duration) (res []*peer.AddrInfo, err error) {
return nil, nil
}
func (n NonPermissioned) ValidatePeer(pid peer.ID, timout time.Duration) (bool, error) {
return true, nil
}
func (n NonPermissioned) ValidatePeers(bootstrapPeers []peer.AddrInfo, timeout time.Duration) (res []peer.AddrInfo, err error) {
return nil, nil
}
func (n NonPermissioned) UpdateIndividualSPProfileCache(pid peer.ID) {
// TODO
}
func (n NonPermissioned) UpdateSPProfileCache(pids []peer.ID) {
// do nothing
}
func (n NonPermissioned) CompareBlockHeights(lhs, rhs permLayer.VersionData) (int, error) {
// TODO
return 0, nil
}
func (n NonPermissioned) GetBlockHeight() (string, error) {
// TODO
return "", nil
}
func (n NonPermissioned) GetBlockHash(blockHeight string) (string, error) {
// TODO
return "", nil
}
func (n NonPermissioned) NewVersionData() (*permLayer.VersionData, error) {
// Not needed, as non-permissioned never stores data
return nil, nil
}
// END NONPERMISSIONED