mirror of https://github.com/hashicorp/consul
parent
1cfb0f1922
commit
975be337a9
@ -0,0 +1,8 @@
|
||||
package cache
|
||||
|
||||
// RPC is an interface that an RPC client must implement. This is a helper
|
||||
// interface that is implemented by the agent delegate so that Type
|
||||
// implementations can request RPC access.
|
||||
type RPC interface {
|
||||
RPC(method string, args interface{}, reply interface{}) error
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cache
|
||||
|
||||
/*
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/consul/agent/structs"
|
||||
)
|
||||
|
||||
// TypeCARoot supports fetching the Connect CA roots.
|
||||
type TypeCARoot struct {
|
||||
RPC RPC
|
||||
}
|
||||
|
||||
func (c *TypeCARoot) Fetch(opts FetchOptions, req Request) (FetchResult, error) {
|
||||
var result FetchResult
|
||||
|
||||
// The request should be a DCSpecificRequest.
|
||||
reqReal, ok := req.(*structs.DCSpecificRequest)
|
||||
if !ok {
|
||||
return result, fmt.Errorf(
|
||||
"Internal cache failure: request wrong type: %T", req)
|
||||
}
|
||||
|
||||
// Set the minimum query index to our current index so we block
|
||||
reqReal.QueryOptions.MinQueryIndex = opts.MinIndex
|
||||
reqReal.QueryOptions.MaxQueryTime = opts.Timeout
|
||||
|
||||
// Fetch
|
||||
var reply structs.IndexedCARoots
|
||||
if err := c.RPC.RPC("ConnectCA.Roots", reqReal, &reply); err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
result.Value = &reply
|
||||
result.Index = reply.QueryMeta.Index
|
||||
return result, nil
|
||||
}
|
||||
*/
|
Loading…
Reference in new issue