migrate

package
v2.0.0-rc.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2014 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeLog4

func DecodeLog4(file *os.File) ([]*etcd4pb.LogEntry, error)

func DecodeNextEntry4

func DecodeNextEntry4(r io.Reader) (*etcd4pb.LogEntry, int, error)

DecodeNextEntry4 unmarshals a v0.4 log entry from a reader. Returns the number of bytes read and any error that occurs.

func Entries4To5

func Entries4To5(ents4 []*etcd4pb.LogEntry) ([]raftpb.Entry, error)

func FindLatestFile

func FindLatestFile(dirpath string) (string, error)

FindLatestFile identifies the "latest" filename in a given directory by sorting all the files and choosing the highest value.

func GuessNodeID

func GuessNodeID(nodes map[string]uint64, snap4 *Snapshot4, cfg *Config4, name string) uint64

func Migrate4To5

func Migrate4To5(dataDir string, name string) error

func NewMember

func NewMember(name string, peerURLs types.URLs, clusterName string) *member

func StorePath

func StorePath(key string) string

func UnixTimeOrPermanent

func UnixTimeOrPermanent(expireTime time.Time) int64

Types

type Command4

type Command4 interface {
	Type5() raftpb.EntryType
	Data5() ([]byte, error)
}

func NewCommand4

func NewCommand4(name string, data []byte, raftMap map[string]uint64) (Command4, error)

type CompareAndDeleteCommand

type CompareAndDeleteCommand struct {
	Key       string `json:"key"`
	PrevValue string `json:"prevValue"`
	PrevIndex uint64 `json:"prevIndex"`
}

func (*CompareAndDeleteCommand) Data5

func (c *CompareAndDeleteCommand) Data5() ([]byte, error)

func (*CompareAndDeleteCommand) Type5

type CompareAndSwapCommand

type CompareAndSwapCommand struct {
	Key        string    `json:"key"`
	Value      string    `json:"value"`
	ExpireTime time.Time `json:"expireTime"`
	PrevValue  string    `json:"prevValue"`
	PrevIndex  uint64    `json:"prevIndex"`
}

func (*CompareAndSwapCommand) Data5

func (c *CompareAndSwapCommand) Data5() ([]byte, error)

func (*CompareAndSwapCommand) Type5

type Config4

type Config4 struct {
	CommitIndex uint64 `json:"commitIndex"`

	Peers []struct {
		Name             string `json:"name"`
		ConnectionString string `json:"connectionString"`
	} `json:"peers"`
}

func DecodeConfig4FromFile

func DecodeConfig4FromFile(cfgPath string) (*Config4, error)

func (*Config4) HardState5

func (c *Config4) HardState5() raftpb.HardState

type CreateCommand

type CreateCommand struct {
	Key        string    `json:"key"`
	Value      string    `json:"value"`
	ExpireTime time.Time `json:"expireTime"`
	Unique     bool      `json:"unique"`
	Dir        bool      `json:"dir"`
}

func (*CreateCommand) Data5

func (c *CreateCommand) Data5() ([]byte, error)

func (*CreateCommand) Type5

func (c *CreateCommand) Type5() raftpb.EntryType

type DefaultJoinCommand

type DefaultJoinCommand struct {
	Name             string `json:"name"`
	ConnectionString string `json:"connectionString"`
}

type DefaultLeaveCommand

type DefaultLeaveCommand struct {
	Name string `json:"name"`
	// contains filtered or unexported fields
}

type DeleteCommand

type DeleteCommand struct {
	Key       string `json:"key"`
	Recursive bool   `json:"recursive"`
	Dir       bool   `json:"dir"`
}

func (*DeleteCommand) Data5

func (c *DeleteCommand) Data5() ([]byte, error)

func (*DeleteCommand) Type5

func (c *DeleteCommand) Type5() raftpb.EntryType

type JoinCommand

type JoinCommand struct {
	Name    string `json:"name"`
	RaftURL string `json:"raftURL"`
	EtcdURL string `json:"etcdURL"`
	// contains filtered or unexported fields
}

func (*JoinCommand) Data5

func (c *JoinCommand) Data5() ([]byte, error)

func (*JoinCommand) Type5

func (c *JoinCommand) Type5() raftpb.EntryType

type Log4

type Log4 []*etcd4pb.LogEntry

func DecodeLog4FromFile

func DecodeLog4FromFile(logpath string) (Log4, error)

func (Log4) NodeIDs

func (l Log4) NodeIDs() map[string]uint64

type NOPCommand

type NOPCommand struct{}

func (NOPCommand) CommandName

func (c NOPCommand) CommandName() string

TODO(bcwaldon): Why is CommandName here?

func (*NOPCommand) Data5

func (c *NOPCommand) Data5() ([]byte, error)

func (*NOPCommand) Type5

func (c *NOPCommand) Type5() raftpb.EntryType

type RemoveCommand

type RemoveCommand struct {
	Name string `json:"name"`
	// contains filtered or unexported fields
}

func (*RemoveCommand) Data5

func (c *RemoveCommand) Data5() ([]byte, error)

func (*RemoveCommand) Type5

func (c *RemoveCommand) Type5() raftpb.EntryType

type SetClusterConfigCommand

type SetClusterConfigCommand struct {
	Config *struct {
		ActiveSize   int     `json:"activeSize"`
		RemoveDelay  float64 `json:"removeDelay"`
		SyncInterval float64 `json:"syncInterval"`
	} `json:"config"`
}

func (*SetClusterConfigCommand) Data5

func (c *SetClusterConfigCommand) Data5() ([]byte, error)

func (*SetClusterConfigCommand) Type5

type SetCommand

type SetCommand struct {
	Key        string    `json:"key"`
	Value      string    `json:"value"`
	ExpireTime time.Time `json:"expireTime"`
	Dir        bool      `json:"dir"`
}

func (*SetCommand) Data5

func (c *SetCommand) Data5() ([]byte, error)

func (*SetCommand) Type5

func (c *SetCommand) Type5() raftpb.EntryType

type Snapshot4

type Snapshot4 struct {
	State     []byte `json:"state"`
	LastIndex uint64 `json:"lastIndex"`
	LastTerm  uint64 `json:"lastTerm"`

	Peers []struct {
		Name             string `json:"name"`
		ConnectionString string `json:"connectionString"`
	} `json:"peers"`
}

func DecodeLatestSnapshot4FromDir

func DecodeLatestSnapshot4FromDir(snapdir string) (*Snapshot4, error)

func DecodeSnapshot4

func DecodeSnapshot4(f *os.File) (*Snapshot4, error)

func DecodeSnapshot4FromFile

func DecodeSnapshot4FromFile(path string) (*Snapshot4, error)

func (*Snapshot4) GetNodesFromStore

func (s *Snapshot4) GetNodesFromStore() map[string]uint64

func (*Snapshot4) Snapshot5

func (s *Snapshot4) Snapshot5() *raftpb.Snapshot

type SnapshotFileName

type SnapshotFileName struct {
	FileName string
	Term     uint64
	Index    uint64
}

func NewSnapshotFileNames

func NewSnapshotFileNames(names []string) ([]SnapshotFileName, error)

type SnapshotFileNames

type SnapshotFileNames []SnapshotFileName

func (*SnapshotFileNames) Len

func (n *SnapshotFileNames) Len() int

func (*SnapshotFileNames) Less

func (n *SnapshotFileNames) Less(i, j int) bool

func (*SnapshotFileNames) Swap

func (n *SnapshotFileNames) Swap(i, j int)

type SyncCommand

type SyncCommand struct {
	Time time.Time `json:"time"`
}

func (*SyncCommand) Data5

func (c *SyncCommand) Data5() ([]byte, error)

func (*SyncCommand) Type5

func (c *SyncCommand) Type5() raftpb.EntryType

type UpdateCommand

type UpdateCommand struct {
	Key        string    `json:"key"`
	Value      string    `json:"value"`
	ExpireTime time.Time `json:"expireTime"`
}

func (*UpdateCommand) Data5

func (c *UpdateCommand) Data5() ([]byte, error)

func (*UpdateCommand) Type5

func (c *UpdateCommand) Type5() raftpb.EntryType

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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