Documentation ¶
Index ¶
- Constants
- Variables
- type Datastore
- func (d *Datastore) Candidates(ctx context.Context) ([]*sdcpb.DataStore, error)
- func (d *Datastore) Config() *config.DatastoreConfig
- func (d *Datastore) ConnectionState() string
- func (d *Datastore) CreateCandidate(ctx context.Context, ds *sdcpb.DataStore) error
- func (d *Datastore) DeleteCache(ctx context.Context) error
- func (d *Datastore) DeleteCandidate(ctx context.Context, name string) error
- func (d *Datastore) DeviationMgr(ctx context.Context)
- func (d *Datastore) Diff(ctx context.Context, req *sdcpb.DiffRequest) (*sdcpb.DiffResponse, error)
- func (d *Datastore) Discard(ctx context.Context, req *sdcpb.DiscardRequest) error
- func (d *Datastore) Get(ctx context.Context, req *sdcpb.GetDataRequest, ...) error
- func (d *Datastore) GetIntent(ctx context.Context, req *sdcpb.GetIntentRequest) (*sdcpb.GetIntentResponse, error)
- func (d *Datastore) ListIntent(ctx context.Context, req *sdcpb.ListIntentRequest) (*sdcpb.ListIntentResponse, error)
- func (d *Datastore) Name() string
- func (d *Datastore) Rebase(ctx context.Context, req *sdcpb.RebaseRequest) error
- func (d *Datastore) Schema() *config.SchemaConfig
- func (d *Datastore) Set(ctx context.Context, req *sdcpb.SetDataRequest) (*sdcpb.SetDataResponse, error)
- func (d *Datastore) SetIntent(ctx context.Context, req *sdcpb.SetIntentRequest) (*sdcpb.SetIntentResponse, error)
- func (d *Datastore) SetIntentUpdate(ctx context.Context, req *sdcpb.SetIntentRequest, candidateName string) (*sdcpb.SetIntentResponse, error)
- func (d *Datastore) Stop() error
- func (d *Datastore) StopDeviationsWatch(peer string)
- func (d *Datastore) Subscribe(req *sdcpb.SubscribeRequest, stream sdcpb.DataServer_SubscribeServer) error
- func (d *Datastore) Sync(ctx context.Context)
- func (d *Datastore) WatchDeviations(req *sdcpb.WatchDeviationRequest, ...) error
- type SdcpbUpdateDedup
Constants ¶
View Source
const (
// to be used for candidates created without an owner
DefaultOwner = "__sdcio"
)
Variables ¶
View Source
var ErrIntentNotFound = errors.New("intent not found")
Functions ¶
This section is empty.
Types ¶
type Datastore ¶
type Datastore struct {
// contains filtered or unexported fields
}
func New ¶
func New(ctx context.Context, c *config.DatastoreConfig, scc schema.Client, cc cache.Client, opts ...grpc.DialOption) *Datastore
New creates a new datastore, its schema server client and initializes the SBI target func New(c *config.DatastoreConfig, schemaServer *config.RemoteSchemaServer) *Datastore {
func (*Datastore) Candidates ¶
func (*Datastore) Config ¶
func (d *Datastore) Config() *config.DatastoreConfig
func (*Datastore) ConnectionState ¶
func (*Datastore) CreateCandidate ¶
func (*Datastore) DeleteCandidate ¶
func (*Datastore) DeviationMgr ¶
func (*Datastore) Diff ¶
func (d *Datastore) Diff(ctx context.Context, req *sdcpb.DiffRequest) (*sdcpb.DiffResponse, error)
func (*Datastore) Get ¶
func (d *Datastore) Get(ctx context.Context, req *sdcpb.GetDataRequest, nCh chan *sdcpb.GetDataResponse) error
func (*Datastore) GetIntent ¶
func (d *Datastore) GetIntent(ctx context.Context, req *sdcpb.GetIntentRequest) (*sdcpb.GetIntentResponse, error)
func (*Datastore) ListIntent ¶
func (d *Datastore) ListIntent(ctx context.Context, req *sdcpb.ListIntentRequest) (*sdcpb.ListIntentResponse, error)
func (*Datastore) Schema ¶
func (d *Datastore) Schema() *config.SchemaConfig
func (*Datastore) Set ¶
func (d *Datastore) Set(ctx context.Context, req *sdcpb.SetDataRequest) (*sdcpb.SetDataResponse, error)
func (*Datastore) SetIntent ¶
func (d *Datastore) SetIntent(ctx context.Context, req *sdcpb.SetIntentRequest) (*sdcpb.SetIntentResponse, error)
func (*Datastore) SetIntentUpdate ¶
func (d *Datastore) SetIntentUpdate(ctx context.Context, req *sdcpb.SetIntentRequest, candidateName string) (*sdcpb.SetIntentResponse, error)
SetIntentUpdate Processes new and updated intents
The main concept is as follows.
- Get all keys from the cache along with the "metadata" (Owner, Priority, etc.) Note: Requesting the values is the expensive task with the default cache implementation
- Filter the keys for entries that belong to the intent (Owner) which is necessary for updated intents (delete config entries that do no longer exist)
- Calculate all the paths that the new intent request touches
- Combine the keys from the two previous steps to query them from the cache just once.
- Query the cache with the resulting keys to also get the values.
- Add the received cache entries to the tree with the new-flag set to false.
- Mark all entries in the tree for the specific owner as deleted.
- Add all the new request entries to the tree with the new flag set to true. The tree will evaluate the values and adjust its internal state (new, deleted and updated) for these entries. If the value remains unchanged, it will reset the new flag if it is a different value, it will set the updated flag and reset the delete flag.
- The tree will be populated with schema information.
- Now the tree can be queried for the highes priority values ".GetHighesPrio(true)". It will also consider the deleted flag and only return new or updated values. This is the calculation the yields the updates that will need to be pushed to the device.
- .GetDeletes() returns the entries that are still marked for deletion. The Paths will be extracted and then send to the device as deletes (path aggregation is applied, if e.g. a whole interface is delted, the deleted paths only contains the delete for the interface, not all its leafs)
- All updates (New & Updated) for the specifc owner / intent are being retrieved from the tree to update the cache.
- All remaining deletes for the specifc owner / intent are being retrieved from the tree to remove them from the cache.
- The request towards southbound is created with the device updates / deletes. A candidate is created, and applied to the device.
- The owner based updates and deletes are being pushed into the cache.
- The raw intent (as received in the req) is stored as a blob in the cache.
func (*Datastore) StopDeviationsWatch ¶
func (*Datastore) Subscribe ¶
func (d *Datastore) Subscribe(req *sdcpb.SubscribeRequest, stream sdcpb.DataServer_SubscribeServer) error
func (*Datastore) WatchDeviations ¶
func (d *Datastore) WatchDeviations(req *sdcpb.WatchDeviationRequest, stream sdcpb.DataServer_WatchDeviationsServer) error
type SdcpbUpdateDedup ¶ added in v0.0.43
type SdcpbUpdateDedup struct {
// contains filtered or unexported fields
}
func NewSdcpbUpdateDedup ¶ added in v0.0.43
func NewSdcpbUpdateDedup() *SdcpbUpdateDedup
func (*SdcpbUpdateDedup) AddUpdate ¶ added in v0.0.43
func (s *SdcpbUpdateDedup) AddUpdate(upd *sdcpb.Update)
func (*SdcpbUpdateDedup) AddUpdates ¶ added in v0.0.43
func (s *SdcpbUpdateDedup) AddUpdates(upds []*sdcpb.Update)
func (*SdcpbUpdateDedup) Updates ¶ added in v0.0.43
func (s *SdcpbUpdateDedup) Updates() []*sdcpb.Update
Source Files ¶
Click to show internal directories.
Click to hide internal directories.