Documentation
¶
Overview ¶
*Copyright (c) 2022, kaydxh * *Permission is hereby granted, free of charge, to any person obtaining a copy *of this software and associated documentation files (the "Software"), to deal *in the Software without restriction, including without limitation the rights *to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *copies of the Software, and to permit persons to whom the Software is *furnished to do so, subject to the following conditions: * *The above copyright notice and this permission notice shall be included in all *copies or substantial portions of the Software. * *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *SOFTWARE.
*Copyright (c) 2022, kaydxh * *Permission is hereby granted, free of charge, to any person obtaining a copy *of this software and associated documentation files (the "Software"), to deal *in the Software without restriction, including without limitation the rights *to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *copies of the Software, and to permit persons to whom the Software is *furnished to do so, subject to the following conditions: * *The above copyright notice and this permission notice shall be included in all *copies or substantial portions of the Software. * *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *SOFTWARE.
*Copyright (c) 2022, kaydxh * *Permission is hereby granted, free of charge, to any person obtaining a copy *of this software and associated documentation files (the "Software"), to deal *in the Software without restriction, including without limitation the rights *to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *copies of the Software, and to permit persons to whom the Software is *furnished to do so, subject to the following conditions: * *The above copyright notice and this permission notice shall be included in all *copies or substantial portions of the Software. * *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *SOFTWARE.
*Copyright (c) 2022, kaydxh * *Permission is hereby granted, free of charge, to any person obtaining a copy *of this software and associated documentation files (the "Software"), to deal *in the Software without restriction, including without limitation the rights *to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *copies of the Software, and to permit persons to whom the Software is *furnished to do so, subject to the following conditions: * *The above copyright notice and this permission notice shall be included in all *copies or substantial portions of the Software. * *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *SOFTWARE.
*Copyright (c) 2022, kaydxh * *Permission is hereby granted, free of charge, to any person obtaining a copy *of this software and associated documentation files (the "Software"), to deal *in the Software without restriction, including without limitation the rights *to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *copies of the Software, and to permit persons to whom the Software is *furnished to do so, subject to the following conditions: * *The above copyright notice and this permission notice shall be included in all *copies or substantial portions of the Software. * *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *SOFTWARE.
*Copyright (c) 2022, kaydxh * *Permission is hereby granted, free of charge, to any person obtaining a copy *of this software and associated documentation files (the "Software"), to deal *in the Software without restriction, including without limitation the rights *to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *copies of the Software, and to permit persons to whom the Software is *furnished to do so, subject to the following conditions: * *The above copyright notice and this permission notice shall be included in all *copies or substantial portions of the Software. * *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *SOFTWARE.
*Copyright (c) 2022, kaydxh * *Permission is hereby granted, free of charge, to any person obtaining a copy *of this software and associated documentation files (the "Software"), to deal *in the Software without restriction, including without limitation the rights *to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *copies of the Software, and to permit persons to whom the Software is *furnished to do so, subject to the following conditions: * *The above copyright notice and this permission notice shall be included in all *copies or substantial portions of the Software. * *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *SOFTWARE.
Index ¶
- Constants
- Variables
- func CloseKV() error
- func GetKV() *clientv3.Client
- func Watch(ctx context.Context, kv *clientv3.Client, key string, ...)
- type CompletedConfig
- type Config
- type ConfigOption
- type ConfigOptionFunc
- type ETCDKV
- type EmptyConfigOption
- type EmptyEtcdKVOption
- type Etcd
- func (*Etcd) Descriptor() ([]byte, []int)deprecated
- func (x *Etcd) GetAddresses() []string
- func (x *Etcd) GetAutoSyncInterval() *durationpb.Duration
- func (x *Etcd) GetDialTimeout() *durationpb.Duration
- func (x *Etcd) GetEnabled() bool
- func (x *Etcd) GetFailAfterDuration() *durationpb.Duration
- func (x *Etcd) GetMaxCallRecvMsgSize() int32
- func (x *Etcd) GetMaxCallSendMsgSize() int32
- func (x *Etcd) GetMaxWaitDuration() *durationpb.Duration
- func (x *Etcd) GetPassword() string
- func (x *Etcd) GetUsername() string
- func (x *Etcd) GetWatchPaths() []string
- func (*Etcd) ProtoMessage()
- func (x *Etcd) ProtoReflect() protoreflect.Message
- func (x *Etcd) Reset()
- func (x *Etcd) String() string
- type EtcdConfig
- type EtcdKV
- func (o *EtcdKV) ApplyOptions(options ...EtcdKVOption) *EtcdKV
- func (d *EtcdKV) Close() error
- func (d *EtcdKV) GetKV(ctx context.Context) (*clientv3.Client, error)
- func (d *EtcdKV) GetKVUntil(ctx context.Context, maxWaitInterval time.Duration, failAfter time.Duration) (*clientv3.Client, error)
- func (d *EtcdKV) Lock(ctx context.Context, opts ...EtcdKVOption) error
- func (d *EtcdKV) TxPipelined(ctx context.Context, cmps []clientv3.Cmp, doOps, elOps []clientv3.Op) error
- func (d *EtcdKV) Unlock(ctx context.Context) error
- func (d *EtcdKV) Watch(ctx context.Context)
- type EtcdKVOption
- func WithAutoSyncInterval(autoSyncInterval time.Duration) EtcdKVOption
- func WithDialTimeout(dialTimeout time.Duration) EtcdKVOption
- func WithLockKey(key string) EtcdKVOption
- func WithLockPrefixPath(prefix string) EtcdKVOption
- func WithLockTTL(ttl time.Duration) EtcdKVOption
- func WithMaxCallRecvMsgSize(msgSize int) EtcdKVOption
- func WithMaxCallSendMsgSize(msgSize int) EtcdKVOption
- func WithWatchCreateCallbackFunc(f EventCallbackFunc) EtcdKVOption
- func WithWatchDeleteCallbackFunc(f EventCallbackFunc) EtcdKVOption
- func WithWatchPaths(paths []string) EtcdKVOption
- type EtcdKVOptionFunc
- type EtcdKVOptions
- type EventCallbackFunc
Constants ¶
const ( DefaultDialTimeout = 5 * time.Second DefaultLockTTL = 15 * time.Second )
Default values for Etcd.
Variables ¶
var File_pkg_discovery_etcd_etcd_proto protoreflect.FileDescriptor
Functions ¶
Types ¶
type CompletedConfig ¶
type CompletedConfig struct {
// contains filtered or unexported fields
}
type Config ¶
type Config struct { Proto Etcd // contains filtered or unexported fields }
func NewConfig ¶
func NewConfig(options ...ConfigOption) *Config
func (*Config) ApplyOptions ¶
func (o *Config) ApplyOptions(options ...ConfigOption) *Config
func (*Config) Complete ¶
func (c *Config) Complete() CompletedConfig
Complete set default ServerRunOptions.
type ConfigOption ¶
type ConfigOption interface {
// contains filtered or unexported methods
}
A ConfigOption sets options.
func WithViper ¶
func WithViper(v *viper.Viper) ConfigOption
type ConfigOptionFunc ¶
type ConfigOptionFunc func(*Config)
ConfigOptionFunc wraps a function that modifies Client into an implementation of the ConfigOption interface.
type EmptyConfigOption ¶
type EmptyConfigOption struct{}
EmptyConfigOption does not alter the configuration. It can be embedded in another structure to build custom options.
This API is EXPERIMENTAL.
type EmptyEtcdKVOption ¶
type EmptyEtcdKVOption struct{}
EmptyEtcdKVUrlOption does not alter the EtcdKVuration. It can be embedded in another structure to build custom options.
This API is EXPERIMENTAL.
type Etcd ¶
type Etcd struct { Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` Addresses []string `protobuf:"bytes,2,rep,name=addresses,proto3" json:"addresses,omitempty"` Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"` Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"` MaxCallSendMsgSize int32 `protobuf:"varint,5,opt,name=max_call_send_msg_size,json=maxCallSendMsgSize,proto3" json:"max_call_send_msg_size,omitempty"` //If 0, it defaults to 2.0 MiB (2 * 1024 * 1024) // MaxCallRecvMsgSize is the client-side response receive limit. // If 0, it defaults to "math.MaxInt32", because range response can // easily exceed request send limits. // Make sure that "MaxCallRecvMsgSize" >= server-side default // send/recv limit. // ("--max-request-bytes" flag to etcd or // "embed.Config.MaxRequestBytes"). MaxCallRecvMsgSize int32 `protobuf:"varint,6,opt,name=max_call_recv_msg_size,json=maxCallRecvMsgSize,proto3" json:"max_call_recv_msg_size,omitempty"` // AutoSyncInterval is the interval to update endpoints with its latest members. // 0 disables auto-sync. By default auto-sync is disabled. AutoSyncInterval *durationpb.Duration `protobuf:"bytes,7,opt,name=auto_sync_interval,json=autoSyncInterval,proto3" json:"auto_sync_interval,omitempty"` DialTimeout *durationpb.Duration `protobuf:"bytes,8,opt,name=dial_timeout,json=dialTimeout,proto3" json:"dial_timeout,omitempty"` MaxWaitDuration *durationpb.Duration `protobuf:"bytes,12,opt,name=max_wait_duration,json=maxWaitDuration,proto3" json:"max_wait_duration,omitempty"` FailAfterDuration *durationpb.Duration `protobuf:"bytes,13,opt,name=fail_after_duration,json=failAfterDuration,proto3" json:"fail_after_duration,omitempty"` WatchPaths []string `protobuf:"bytes,14,rep,name=watch_paths,json=watchPaths,proto3" json:"watch_paths,omitempty"` // contains filtered or unexported fields }
func (*Etcd) Descriptor
deprecated
func (*Etcd) GetAddresses ¶
func (*Etcd) GetAutoSyncInterval ¶
func (x *Etcd) GetAutoSyncInterval() *durationpb.Duration
func (*Etcd) GetDialTimeout ¶
func (x *Etcd) GetDialTimeout() *durationpb.Duration
func (*Etcd) GetEnabled ¶
func (*Etcd) GetFailAfterDuration ¶
func (x *Etcd) GetFailAfterDuration() *durationpb.Duration
func (*Etcd) GetMaxCallRecvMsgSize ¶
func (*Etcd) GetMaxCallSendMsgSize ¶
func (*Etcd) GetMaxWaitDuration ¶
func (x *Etcd) GetMaxWaitDuration() *durationpb.Duration
func (*Etcd) GetPassword ¶
func (*Etcd) GetUsername ¶
func (*Etcd) GetWatchPaths ¶
func (*Etcd) ProtoMessage ¶
func (*Etcd) ProtoMessage()
func (*Etcd) ProtoReflect ¶
func (x *Etcd) ProtoReflect() protoreflect.Message
type EtcdConfig ¶
type EtcdKV ¶
type EtcdKV struct { Conf EtcdConfig *clientv3.Client // contains filtered or unexported fields }
func NewEtcdKV ¶
func NewEtcdKV(conf EtcdConfig, opts ...EtcdKVOption) *EtcdKV
func (*EtcdKV) ApplyOptions ¶
func (o *EtcdKV) ApplyOptions(options ...EtcdKVOption) *EtcdKV
func (*EtcdKV) GetKVUntil ¶
func (*EtcdKV) TxPipelined ¶
type EtcdKVOption ¶
type EtcdKVOption interface {
// contains filtered or unexported methods
}
A EtcdKVOption sets options.
func WithAutoSyncInterval ¶
func WithAutoSyncInterval(autoSyncInterval time.Duration) EtcdKVOption
func WithDialTimeout ¶
func WithDialTimeout(dialTimeout time.Duration) EtcdKVOption
func WithLockKey ¶
func WithLockKey(key string) EtcdKVOption
func WithLockPrefixPath ¶
func WithLockPrefixPath(prefix string) EtcdKVOption
func WithLockTTL ¶
func WithLockTTL(ttl time.Duration) EtcdKVOption
func WithMaxCallRecvMsgSize ¶
func WithMaxCallRecvMsgSize(msgSize int) EtcdKVOption
func WithMaxCallSendMsgSize ¶
func WithMaxCallSendMsgSize(msgSize int) EtcdKVOption
func WithWatchCreateCallbackFunc ¶
func WithWatchCreateCallbackFunc(f EventCallbackFunc) EtcdKVOption
func WithWatchDeleteCallbackFunc ¶
func WithWatchDeleteCallbackFunc(f EventCallbackFunc) EtcdKVOption
func WithWatchPaths ¶
func WithWatchPaths(paths []string) EtcdKVOption
type EtcdKVOptionFunc ¶
type EtcdKVOptionFunc func(*EtcdKV)
EtcdKVOptionFunc wraps a function that modifies EtcdKV into an implementation of the EtcdKVOption interface.