etcd

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

* 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 * * 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.

* 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 * * 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.

* 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 * * 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.

* 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 * * 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.

* 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 * * 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.

* 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 * * 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.

* 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 * * 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.

* 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 * * 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.

* 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 * * 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 (
	// force re-list
	DefaultForceListInterval = 4
	DefaultMetricsInterval   = 30 * time.Second
)

Variables

This section is empty.

Functions

func FromEtcdKeyValue

func FromEtcdKeyValue(dist *discovery.KeyValue, src *mvccpb.KeyValue, parser proto.Parser) (err error)

func InitConfigs

func InitConfigs()

func NewRepository

func NewRepository() mgr.Instance

func ReportCacheSize

func ReportCacheSize(resource, t string, s int)

Types

type Adaptor

type Adaptor struct {
	discovery.Cacher
	discovery.Indexer
}

Adaptor implements discovery.Adaptor. Adaptor does service discovery with etcd as it's registry.

func NewEtcdAdaptor

func NewEtcdAdaptor(name string, cfg *discovery.Config) *Adaptor

func (*Adaptor) Ready

func (se *Adaptor) Ready() <-chan struct{}

func (*Adaptor) Run

func (se *Adaptor) Run()

func (*Adaptor) Stop

func (se *Adaptor) Stop()

type CacheIndexer

type CacheIndexer struct {
	*Indexer
	*discovery.CacheIndexer
}

CacheIndexer implements discovery.Indexer. CacheIndexer searches data from etcd cache(firstly) and etcd server(secondly).

func NewCacheIndexer

func NewCacheIndexer(cfg *discovery.Config, cache discovery.Cache) *CacheIndexer

func (*CacheIndexer) Creditable

func (i *CacheIndexer) Creditable() bool

Creditable implements discovery.Indexer.Creditable.

func (*CacheIndexer) Search

type Indexer

type Indexer struct {
	Client registry.Registry
	Parser proto.Parser
	Root   string
}

Indexer implements discovery.Indexer. Indexer searches data from etcd server.

func NewEtcdIndexer

func NewEtcdIndexer(root string, p proto.Parser) (indexer *Indexer)

func (*Indexer) CheckPrefix

func (i *Indexer) CheckPrefix(key string) error

func (*Indexer) Creditable

func (i *Indexer) Creditable() bool

Creditable implements discovery.Indexer.Creditable.

func (*Indexer) Search

func (i *Indexer) Search(ctx context.Context, opts ...registry.PluginOpOption) (r *discovery.Response, err error)

type KvCacher

type KvCacher struct {
	Cfg *discovery.Config
	// contains filtered or unexported fields
}

KvCacher implements discovery.Cacher. KvCacher manages etcd cache. To update cache, KvCacher watch etcd event and pull data periodly from etcd. When the cache data changes, KvCacher creates events and notifies it's subscribers. Use Cfg to set it's behaviors.

func NewKvCacher

func NewKvCacher(cfg *discovery.Config, cache discovery.Cache) *KvCacher

func (*KvCacher) Cache

func (c *KvCacher) Cache() discovery.CacheReader

func (*KvCacher) Config

func (c *KvCacher) Config() *discovery.Config

func (*KvCacher) IsReady

func (c *KvCacher) IsReady() bool

func (*KvCacher) ListAndWatch

func (c *KvCacher) ListAndWatch(ctx context.Context) error

func (*KvCacher) Ready

func (c *KvCacher) Ready() <-chan struct{}

func (*KvCacher) Run

func (c *KvCacher) Run()

func (*KvCacher) Stop

func (c *KvCacher) Stop()

type ListWatch

type ListWatch interface {
	List(op ListWatchConfig) (*registry.PluginResponse, error)
	// not support new multiple watchers
	Watch(op ListWatchConfig) Watcher
	//
	DoWatch(ctx context.Context, f func(*registry.PluginResponse)) error
	Revision() int64
}

type ListWatchConfig

type ListWatchConfig struct {
	Timeout time.Duration
	Context context.Context
}

func (*ListWatchConfig) String

func (lo *ListWatchConfig) String() string

type Repository

type Repository struct {
}

func (*Repository) New

type Watcher

type Watcher interface {
	EventBus() <-chan *registry.PluginResponse
	Stop()
}

Jump to

Keyboard shortcuts

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