v2

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2014 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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

Jump to

Keyboard shortcuts

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