Documentation ¶
Overview ¶
Package storage
@author: xwc1125
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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 *
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.
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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 *
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
- Variables
- func Close() error
- func InitETCDClient(etcdConf *EtcdConfig) error
- type EtcdConfig
- type EtcdV3Storage
- func (s *EtcdV3Storage) BatchDelete(ctx context.Context, keys []string) error
- func (s *EtcdV3Storage) Close() error
- func (s *EtcdV3Storage) Create(ctx context.Context, key, val string) error
- func (s *EtcdV3Storage) Get(ctx context.Context, key string) (string, error)
- func (s *EtcdV3Storage) List(ctx context.Context, key string) ([]Keypair, error)
- func (s *EtcdV3Storage) Update(ctx context.Context, key, val string) error
- func (s *EtcdV3Storage) Watch(ctx context.Context, key string) <-chan WatchResponse
- type Event
- type EventType
- type Interface
- type Keypair
- type MockInterface
- func (_m *MockInterface) BatchDelete(ctx context.Context, keys []string) error
- func (_m *MockInterface) Create(ctx context.Context, key string, val string) error
- func (_m *MockInterface) Get(ctx context.Context, key string) (string, error)
- func (_m *MockInterface) List(ctx context.Context, key string) ([]Keypair, error)
- func (_m *MockInterface) Update(ctx context.Context, key string, val string) error
- func (_m *MockInterface) Watch(ctx context.Context, key string) <-chan WatchResponse
- type Tls
- type WatchResponse
Constants ¶
const ( // SkippedValueEtcdInitDir indicates the init_dir // etcd event will be skipped. SkippedValueEtcdInitDir = "init_dir" // SkippedValueEtcdEmptyObject indicates the data with an // empty JSON value {}, which may be set by APISIX, // should be also skipped. // // Important: at present, {} is considered as invalid, // but may be changed in the future. SkippedValueEtcdEmptyObject = "{}" )
Variables ¶
var (
Client *clientv3.Client
)
Functions ¶
func InitETCDClient ¶
func InitETCDClient(etcdConf *EtcdConfig) error
Types ¶
type EtcdConfig ¶
type EtcdConfig struct { Endpoints []string `json:"endpoints" mapstructure:"endpoints" yaml:"endpoints"` Username string `json:"username" mapstructure:"username" yaml:"username"` Password string `json:"password" mapstructure:"password" yaml:"password"` Tls *Tls `json:"tls" mapstructure:"tls" yaml:"tls"` Prefix string `json:"prefix" mapstructure:"prefix" yaml:"prefix"` }
type EtcdV3Storage ¶
type EtcdV3Storage struct {
// contains filtered or unexported fields
}
func GenEtcdStorage ¶
func GenEtcdStorage() *EtcdV3Storage
func NewETCDStorage ¶
func NewETCDStorage(etcdConf *EtcdConfig) (*EtcdV3Storage, error)
func (*EtcdV3Storage) BatchDelete ¶
func (s *EtcdV3Storage) BatchDelete(ctx context.Context, keys []string) error
func (*EtcdV3Storage) Close ¶
func (s *EtcdV3Storage) Close() error
func (*EtcdV3Storage) Create ¶
func (s *EtcdV3Storage) Create(ctx context.Context, key, val string) error
func (*EtcdV3Storage) Update ¶
func (s *EtcdV3Storage) Update(ctx context.Context, key, val string) error
func (*EtcdV3Storage) Watch ¶
func (s *EtcdV3Storage) Watch(ctx context.Context, key string) <-chan WatchResponse
type Interface ¶
type Interface interface { Get(ctx context.Context, key string) (string, error) List(ctx context.Context, key string) ([]Keypair, error) Create(ctx context.Context, key, val string) error Update(ctx context.Context, key, val string) error BatchDelete(ctx context.Context, keys []string) error Watch(ctx context.Context, key string) <-chan WatchResponse }
type MockInterface ¶
MockInterface is an autogenerated mock type for the Interface type
func (*MockInterface) BatchDelete ¶
func (_m *MockInterface) BatchDelete(ctx context.Context, keys []string) error
BatchDelete provides a mock function with given fields: ctx, keys
func (*MockInterface) Watch ¶
func (_m *MockInterface) Watch(ctx context.Context, key string) <-chan WatchResponse
Watch provides a mock function with given fields: ctx, key