package v2

import "github.com/coreos/etcd/store/v2"

Index

Types

type CommandFactory

type CommandFactory struct {
}

CommandFactory provides a pluggable way to create version 2 commands.

func (*CommandFactory) CreateCompareAndDeleteCommand

func (f *CommandFactory) CreateCompareAndDeleteCommand(key string, prevValue string, prevIndex uint64) raft.Command

CreateCompareAndDeleteCommand creates a version 2 command to conditionally delete a key from the store.

func (*CommandFactory) CreateCompareAndSwapCommand

func (f *CommandFactory) CreateCompareAndSwapCommand(key string, value string, prevValue string, prevIndex uint64, expireTime time.Time) raft.Command

CreateCompareAndSwapCommand creates a version 2 command to conditionally set a key in the store.

func (*CommandFactory) CreateCreateCommand

func (f *CommandFactory) CreateCreateCommand(key string, dir bool, value string, expireTime time.Time, unique bool) raft.Command

CreateCreateCommand creates a version 2 command to create a new key in the store.

func (*CommandFactory) CreateDeleteCommand

func (f *CommandFactory) CreateDeleteCommand(key string, dir, recursive bool) raft.Command

CreateDeleteCommand creates a version 2 command to delete a key from the store.

func (*CommandFactory) CreateGetCommand

func (f *CommandFactory) CreateGetCommand(key string, recursive, sorted bool) raft.Command

func (*CommandFactory) CreateSetCommand

func (f *CommandFactory) CreateSetCommand(key string, dir bool, value string, expireTime time.Time) raft.Command

CreateSetCommand creates a version 2 command to set a key to a given value in the store.

func (*CommandFactory) CreateSyncCommand

func (f *CommandFactory) CreateSyncCommand(now time.Time) raft.Command

func (*CommandFactory) CreateUpdateCommand

func (f *CommandFactory) CreateUpdateCommand(key string, value string, expireTime time.Time) raft.Command

CreateUpdateCommand creates a version 2 command to update a key to a given value in the store.

func (*CommandFactory) CreateUpgradeCommand

func (f *CommandFactory) CreateUpgradeCommand() raft.Command

CreateUpgradeCommand is a no-op since version 2 is the first version to support store versioning.

func (*CommandFactory) Version

func (f *CommandFactory) Version() int

Version returns the version of this factory.

type CompareAndDeleteCommand

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

The CompareAndDelete performs a conditional delete on a key in the store.

func (*CompareAndDeleteCommand) Apply

func (c *CompareAndDeleteCommand) Apply(server raft.Server) (interface{}, error)

Set the key-value pair if the current value of the key equals to the given prevValue

func (*CompareAndDeleteCommand) CommandName

func (c *CompareAndDeleteCommand) CommandName() string

The name of the compareAndDelete command in the log

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"`
}

The CompareAndSwap performs a conditional update on a key in the store.

func (*CompareAndSwapCommand) Apply

func (c *CompareAndSwapCommand) Apply(context raft.Context) (interface{}, error)

Set the key-value pair if the current value of the key equals to the given prevValue

func (*CompareAndSwapCommand) CommandName

func (c *CompareAndSwapCommand) CommandName() string

The name of the testAndSet command in the log

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"`
}

Create command

func (*CreateCommand) Apply

func (c *CreateCommand) Apply(context raft.Context) (interface{}, error)

Create node

func (*CreateCommand) CommandName

func (c *CreateCommand) CommandName() string

The name of the create command in the log

type DeleteCommand

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

The DeleteCommand removes a key from the Store.

func (*DeleteCommand) Apply

func (c *DeleteCommand) Apply(context raft.Context) (interface{}, error)

Delete the key

func (*DeleteCommand) CommandName

func (c *DeleteCommand) CommandName() string

The name of the delete command in the log

type GetCommand

type GetCommand struct {
	Key       string `json:"key"`
	Recursive bool   `json:"recursive"`
	Sorted    bool   `json:sorted`
}

The GetCommand gets a key from the Store.

func (*GetCommand) Apply

func (c *GetCommand) Apply(context raft.Context) (interface{}, error)

Get the key

func (*GetCommand) CommandName

func (c *GetCommand) CommandName() string

The name of the get command in the log

type SetCommand

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

Create command

func (*SetCommand) Apply

func (c *SetCommand) Apply(context raft.Context) (interface{}, error)

Create node

func (*SetCommand) CommandName

func (c *SetCommand) CommandName() string

The name of the create command in the log

type SyncCommand

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

func (SyncCommand) Apply

func (c SyncCommand) Apply(context raft.Context) (interface{}, error)

func (SyncCommand) CommandName

func (c SyncCommand) CommandName() string

The name of the Sync command in the log

type UpdateCommand

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

Update command

func (*UpdateCommand) Apply

func (c *UpdateCommand) Apply(context raft.Context) (interface{}, error)

Create node

func (*UpdateCommand) CommandName

func (c *UpdateCommand) CommandName() string

The name of the update command in the log

Source Files

command_factory.go compare_and_delete_command.go compare_and_swap_command.go create_command.go delete_command.go get_command.go set_command.go sync_command.go update_command.go

Version
v0.4.6
Published
Jul 29, 2014
Platform
js/wasm
Imports
4 packages
Last checked
2 hours ago

Tools for package owners.