Add basic "post resource publish support"

Fixes #7146
This commit is contained in:
Bjørn Erik Pedersen
2020-02-25 21:40:02 +01:00
parent 8568928aa8
commit 2f721f8ec6
18 changed files with 619 additions and 36 deletions

View File

@@ -4,6 +4,7 @@ import (
"path/filepath"
"strings"
"sync"
"sync/atomic"
)
// NewIdentityManager creates a new Manager starting at id.
@@ -139,3 +140,18 @@ func (im *identityManager) Search(id Identity) Provider {
defer im.Unlock()
return im.ids.search(0, id.GetIdentity())
}
// Incrementer increments and returns the value.
// Typically used for IDs.
type Incrementer interface {
Incr() int
}
// IncrementByOne implements Incrementer adding 1 every time Incr is called.
type IncrementByOne struct {
counter uint64
}
func (c *IncrementByOne) Incr() int {
return int(atomic.AddUint64(&c.counter, uint64(1)))
}