db

package
v7.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2024 License: Apache-2.0 Imports: 9 Imported by: 1

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

View Source
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

func (b *Backend) CreateWatch(ctx context.Context, key string, withPrefix bool) chan *kvstore.Event

CreateWatch starts watching events for the specified key

func (*Backend) Delete

func (b *Backend) Delete(ctx context.Context, key string) error

Delete removes an item under the specified key

func (*Backend) DeleteWatch

func (b *Backend) DeleteWatch(ctx context.Context, key string, ch chan *kvstore.Event)

DeleteWatch stops watching events for the specified key

func (*Backend) DeleteWithPrefix

func (b *Backend) DeleteWithPrefix(ctx context.Context, prefixKey string) error

func (*Backend) EnableLivenessChannel

func (b *Backend) EnableLivenessChannel(ctx context.Context) chan bool

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) Get

func (b *Backend) Get(ctx context.Context, key string) (*kvstore.KVPair, error)

Get retrieves an item that matches the specified key

func (*Backend) List

func (b *Backend) List(ctx context.Context, key string) (map[string]*kvstore.KVPair, error)

List retrieves one or more items that match the specified key

func (*Backend) PerformLivenessCheck

func (b *Backend) PerformLivenessCheck(ctx context.Context) bool

Perform a dummy Key Lookup on kvstore to test Connection Liveness and post on Liveness channel

func (*Backend) Put

func (b *Backend) Put(ctx context.Context, key string, value interface{}) error

Put stores an item value under the specifed key

Directories

Path Synopsis
* Copyright 2018-2024 Open Networking Foundation (ONF) and the ONF Contributors
* Copyright 2018-2024 Open Networking Foundation (ONF) and the ONF Contributors

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL