Documentation ¶
Overview ¶
* Copyright 2020-2024 Open Networking Foundation (ONF) and the ONF Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
Index ¶
- Constants
- type Backend
- func (b *Backend) CreateWatch(ctx context.Context, key string, withPrefix bool) chan *kvstore.Event
- func (b *Backend) Delete(ctx context.Context, key string) error
- func (b *Backend) DeleteWatch(ctx context.Context, key string, ch chan *kvstore.Event)
- func (b *Backend) DeleteWithPrefix(ctx context.Context, prefixKey string) error
- func (b *Backend) EnableLivenessChannel(ctx context.Context) chan bool
- func (b *Backend) Get(ctx context.Context, key string) (*kvstore.KVPair, error)
- func (b *Backend) List(ctx context.Context, key string) (map[string]*kvstore.KVPair, error)
- func (b *Backend) PerformLivenessCheck(ctx context.Context) bool
- func (b *Backend) Put(ctx context.Context, key string, value interface{}) error
Constants ¶
const ( // Default Minimal Interval for posting alive state of backend kvstore on Liveness Channel DefaultLivenessChannelInterval = time.Second * 30 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct { Client kvstore.Client StoreType string Timeout time.Duration Address string PathPrefix string LivenessChannelInterval time.Duration // regularly push alive state beyond this interval // contains filtered or unexported fields }
Backend structure holds details for accessing the kv store
func NewBackend ¶
func NewBackend(ctx context.Context, storeType string, address string, timeout time.Duration, pathPrefix string) *Backend
NewBackend creates a new instance of a Backend structure
func (*Backend) CreateWatch ¶
CreateWatch starts watching events for the specified key
func (*Backend) DeleteWatch ¶
DeleteWatch stops watching events for the specified key
func (*Backend) DeleteWithPrefix ¶
func (*Backend) EnableLivenessChannel ¶
Enable the liveness monitor channel. This channel will report a "true" or "false" on every kvstore operation which indicates whether or not the connection is still Live. This channel is then picked up by the service (i.e. rw_core / ro_core) to update readiness status and/or take other actions.
func (*Backend) PerformLivenessCheck ¶
Perform a dummy Key Lookup on kvstore to test Connection Liveness and post on Liveness channel