mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
*: use new adt.IntervalTree interface
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
This commit is contained in:
parent
ffe90b9ff3
commit
08124105ad
@ -27,8 +27,8 @@ func getMergedPerms(tx backend.BatchTx, userName string) *unifiedRangePermission
|
||||
return nil
|
||||
}
|
||||
|
||||
readPerms := &adt.IntervalTree{}
|
||||
writePerms := &adt.IntervalTree{}
|
||||
readPerms := adt.NewIntervalTree()
|
||||
writePerms := adt.NewIntervalTree()
|
||||
|
||||
for _, roleName := range user.Roles {
|
||||
role := getRole(tx, roleName)
|
||||
@ -128,6 +128,6 @@ func (as *authStore) invalidateCachedPerm(userName string) {
|
||||
}
|
||||
|
||||
type unifiedRangePermissions struct {
|
||||
readPerms *adt.IntervalTree
|
||||
writePerms *adt.IntervalTree
|
||||
readPerms adt.IntervalTree
|
||||
writePerms adt.IntervalTree
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func TestRangePermission(t *testing.T) {
|
||||
}
|
||||
|
||||
for i, tt := range tests {
|
||||
readPerms := &adt.IntervalTree{}
|
||||
readPerms := adt.NewIntervalTree()
|
||||
for _, p := range tt.perms {
|
||||
readPerms.Insert(p, struct{}{})
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ func checkTxnRequest(r *pb.TxnRequest, maxTxnOps int) error {
|
||||
// there is an overlap, returns an error. If no overlap, return put and delete
|
||||
// sets for recursive evaluation.
|
||||
func checkIntervals(reqs []*pb.RequestOp) (map[string]struct{}, adt.IntervalTree, error) {
|
||||
var dels adt.IntervalTree
|
||||
dels := adt.NewIntervalTree()
|
||||
|
||||
// collect deletes from this level; build first to check lower level overlapped puts
|
||||
for _, req := range reqs {
|
||||
|
@ -156,6 +156,7 @@ type watcherGroup struct {
|
||||
func newWatcherGroup() watcherGroup {
|
||||
return watcherGroup{
|
||||
keyWatchers: make(watcherSetByKey),
|
||||
ranges: adt.NewIntervalTree(),
|
||||
watchers: make(watcherSet),
|
||||
}
|
||||
}
|
||||
|
1
proxy/grpcproxy/cache/store.go
vendored
1
proxy/grpcproxy/cache/store.go
vendored
@ -53,6 +53,7 @@ func keyFunc(req *pb.RangeRequest) string {
|
||||
func NewCache(maxCacheEntries int) Cache {
|
||||
return &cache{
|
||||
lru: lru.New(maxCacheEntries),
|
||||
cachedRanges: adt.NewIntervalTree(),
|
||||
compactedRev: -1,
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user