myetcd

package
v0.0.0-...-43f4138 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Copyright 2017 by GoSpider author. 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EtcdConfig

type EtcdConfig struct {
	Host    string
	Port    string
	Prefix  string
	Timeout int
}

type MyEtcd

type MyEtcd struct {
	Config EtcdConfig
	Client client.KeysAPI
}

func NewEtcd

func NewEtcd(config EtcdConfig) (*MyEtcd, error)

使用见test

func (*MyEtcd) Exist

func (myetcd *MyEtcd) Exist(key string) bool

是否存在Key

func (*MyEtcd) Get

func (myetcd *MyEtcd) Get(key string) string

可以取目录:空

func (*MyEtcd) GetAll

func (myetcd *MyEtcd) GetAll(key string) (*client.Node, error)

func (*MyEtcd) IsDir

func (myetcd *MyEtcd) IsDir(key string) error

是否是目录,nil则是

func (*MyEtcd) IsKeyNotFound

func (myetcd *MyEtcd) IsKeyNotFound(e error) bool

func (*MyEtcd) List

func (myetcd *MyEtcd) List(key string) (client.Nodes, error)

列出儿子们

func (*MyEtcd) ListR

func (myetcd *MyEtcd) ListR(key string) (client.Nodes, error)

func (*MyEtcd) Rm

func (myetcd *MyEtcd) Rm(key string) error

删除key

func (*MyEtcd) RmAll

func (myetcd *MyEtcd) RmAll(key string) error

级联删除key(值也是)

func (*MyEtcd) Set

func (myetcd *MyEtcd) Set(key, value string) error

放值,是目录会失败

func (*MyEtcd) SetDir

func (myetcd *MyEtcd) SetDir(key string) error

创建目录,存在Key报错,目录已经存在不报错,如果a/b是key,那么不能新建a/b/c目录

func (*MyEtcd) StrictGet

func (myetcd *MyEtcd) StrictGet(key string) (string, error)

严格模式取,不能取目录

func (*MyEtcd) StrictRm

func (myetcd *MyEtcd) StrictRm(key string) error

Jump to

Keyboard shortcuts

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