migrate

package
v2.0.5-0...-4eae0e0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2015 License: Apache-2.0 Imports: 26 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 Entries4To2

func Entries4To2(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 Migrate4To2

func Migrate4To2(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 {
	Type2() raftpb.EntryType
	Data2() ([]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) Data2

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

func (*CompareAndDeleteCommand) Type2

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) Data2

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

func (*CompareAndSwapCommand) Type2

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) HardState2

func (c *Config4) HardState2() 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) Data2

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

func (*CreateCommand) Type2

func (c *CreateCommand) Type2() 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) Data2

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

func (*DeleteCommand) Type2

func (c *DeleteCommand) Type2() 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) Data2

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

func (*JoinCommand) Type2

func (c *JoinCommand) Type2() 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 MachineMessage

type MachineMessage struct {
	Name      string `json:"name"`
	State     string `json:"state"`
	ClientURL string `json:"clientURL"`
	PeerURL   string `json:"peerURL"`
}

MachineMessage represents information about a peer or standby in the registry.

type NOPCommand

type NOPCommand struct{}

func (NOPCommand) CommandName

func (c NOPCommand) CommandName() string

TODO(bcwaldon): Why is CommandName here?

func (*NOPCommand) Data2

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

func (*NOPCommand) Type2

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

type RemoveCommand

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

func (*RemoveCommand) Data2

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

func (*RemoveCommand) Type2

func (c *RemoveCommand) Type2() 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) Data2

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

func (*SetClusterConfigCommand) Type2

type SetCommand

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

func (*SetCommand) Data2

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

func (*SetCommand) Type2

func (c *SetCommand) Type2() 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) Snapshot2

func (s *Snapshot4) Snapshot2() *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 StandbyInfo4

type StandbyInfo4 struct {
	Running      bool
	Cluster      []*MachineMessage
	SyncInterval float64
}

func DecodeStandbyInfo4FromFile

func DecodeStandbyInfo4FromFile(path string) (*StandbyInfo4, error)

func (*StandbyInfo4) ClientURLs

func (si *StandbyInfo4) ClientURLs() []string

func (*StandbyInfo4) InitialCluster

func (si *StandbyInfo4) InitialCluster() string

type Store4

type Store4 struct {
	Root           *node
	CurrentIndex   uint64
	CurrentVersion int
}

type SyncCommand

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

func (*SyncCommand) Data2

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

func (*SyncCommand) Type2

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

type UpdateCommand

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

func (*UpdateCommand) Data2

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

func (*UpdateCommand) Type2

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

Directories

Path Synopsis
cmd
Package protobuf is a generated protocol buffer package.
Package protobuf is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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