mirror of https://github.com/status-im/consul.git
agent/cache: address PR feedback, lots of typos
This commit is contained in:
parent
02b20a0353
commit
bd3b8e042a
|
@ -295,8 +295,9 @@ func (a *Agent) Start() error {
|
|||
// regular and on-demand state synchronizations (anti-entropy).
|
||||
a.sync = ae.NewStateSyncer(a.State, c.AEInterval, a.shutdownCh, a.logger)
|
||||
|
||||
// create the cache
|
||||
// create the cache and register types
|
||||
a.cache = cache.New(nil)
|
||||
a.registerCache()
|
||||
|
||||
// create the config for the rpc server/client
|
||||
consulCfg, err := a.consulConfig()
|
||||
|
@ -334,9 +335,6 @@ func (a *Agent) Start() error {
|
|||
a.State.Delegate = a.delegate
|
||||
a.State.TriggerSyncChanges = a.sync.SyncChanges.Trigger
|
||||
|
||||
// Register the cache
|
||||
a.registerCache()
|
||||
|
||||
// Load checks/services/metadata.
|
||||
if err := a.loadServices(c); err != nil {
|
||||
return err
|
||||
|
|
|
@ -98,7 +98,9 @@ func (c *ConnectCALeaf) Fetch(opts cache.FetchOptions, req cache.Request) (cache
|
|||
}
|
||||
|
||||
// Create a CSR.
|
||||
// TODO(mitchellh): This is obviously not production ready!
|
||||
// TODO(mitchellh): This is obviously not production ready! The host
|
||||
// needs a correct host ID, and we probably don't want to use TestCSR
|
||||
// and want a non-test-specific way to create a CSR.
|
||||
csr, pk := connect.TestCSR(&testing.RuntimeT{}, &connect.SpiffeIDService{
|
||||
Host: "1234.consul",
|
||||
Namespace: "default",
|
||||
|
|
|
@ -35,7 +35,7 @@ func TestIntentionMatch(t *testing.T) {
|
|||
MinIndex: 24,
|
||||
Timeout: 1 * time.Second,
|
||||
}, &structs.IntentionQueryRequest{Datacenter: "dc1"})
|
||||
require.Nil(err)
|
||||
require.NoError(err)
|
||||
require.Equal(cache.FetchResult{
|
||||
Value: resp,
|
||||
Index: 48,
|
||||
|
@ -51,7 +51,7 @@ func TestIntentionMatch_badReqType(t *testing.T) {
|
|||
// Fetch
|
||||
_, err := typ.Fetch(cache.FetchOptions{}, cache.TestRequest(
|
||||
t, cache.RequestInfo{Key: "foo", MinIndex: 64}))
|
||||
require.NotNil(err)
|
||||
require.Error(err)
|
||||
require.Contains(err.Error(), "wrong type")
|
||||
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ func (c *Cache) Get(t string, r Request) (interface{}, error) {
|
|||
// First time through
|
||||
first := true
|
||||
|
||||
// timeoutCh for watching our tmeout
|
||||
// timeoutCh for watching our timeout
|
||||
var timeoutCh <-chan time.Time
|
||||
|
||||
RETRY_GET:
|
||||
|
|
|
@ -18,7 +18,7 @@ type Request interface {
|
|||
// cacheability.
|
||||
type RequestInfo struct {
|
||||
// Key is a unique cache key for this request. This key should
|
||||
// absolutely uniquely identify this request, since any conflicting
|
||||
// be globally unique to identify this request, since any conflicting
|
||||
// cache keys could result in invalid data being returned from the cache.
|
||||
// The Key does not need to include ACL or DC information, since the
|
||||
// cache already partitions by these values prior to using this key.
|
||||
|
|
|
@ -4,12 +4,12 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
// Type implement the logic to fetch certain types of data.
|
||||
// Type implements the logic to fetch certain types of data.
|
||||
type Type interface {
|
||||
// Fetch fetches a single unique item.
|
||||
//
|
||||
// The FetchOptions contain the index and timeouts for blocking queries.
|
||||
// The CacheMinIndex value on the Request itself should NOT be used
|
||||
// The MinIndex value on the Request itself should NOT be used
|
||||
// as the blocking index since a request may be reused multiple times
|
||||
// as part of Refresh behavior.
|
||||
//
|
||||
|
|
|
@ -270,7 +270,7 @@ func (q *IntentionQueryRequest) RequestDatacenter() string {
|
|||
return q.Datacenter
|
||||
}
|
||||
|
||||
// cache.Request impl.
|
||||
// CacheInfo implements cache.Request
|
||||
func (q *IntentionQueryRequest) CacheInfo() cache.RequestInfo {
|
||||
// We only support caching Match queries, so if Match isn't set,
|
||||
// then return an empty info object which will cause a pass-through
|
||||
|
@ -294,7 +294,7 @@ func (q *IntentionQueryRequest) CacheInfo() cache.RequestInfo {
|
|||
// If there is an error, we don't set the key. A blank key forces
|
||||
// no cache for this request so the request is forwarded directly
|
||||
// to the server.
|
||||
info.Key = strconv.FormatUint(v, 10)
|
||||
info.Key = strconv.FormatUint(v, 16)
|
||||
}
|
||||
|
||||
return info
|
||||
|
|
Loading…
Reference in New Issue