twopc

package
v0.0.0-...-ef80819 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package twopc is two phase commit implements for key-value store

Index

Constants

This section is empty.

Variables

View Source
var DebugLevel int

DebugLevel determine the amount of debug output

Functions

func NewConsensus

func NewConsensus(serverAddr string) (transparent.Layer, error)

NewConsensus returns Two phase commit consensus layer

Types

type Coodinator

type Coodinator struct {
	// contains filtered or unexported fields
}

Coodinator distribute vote request

func NewCoodinator

func NewCoodinator(serverAddr string) (*Coodinator, error)

NewCoodinator returns started Coodinator

func (*Coodinator) Connection

func (c *Coodinator) Connection(stream pb.Cluster_ConnectionServer) error

Connection start and keep connection for each client

func (*Coodinator) Set

func (c *Coodinator) Set(ctx context.Context, req *pb.SetRequest) (*pb.EmptyMessage, error)

Set accepts request from any client

func (*Coodinator) SetTimeout

func (c *Coodinator) SetTimeout(millisecond time.Duration)

SetTimeout change timeout default is 1000 milliseconds

type Participant

type Participant struct {
	// contains filtered or unexported fields
}

Participant manage its resource

func NewParticipant

func NewParticipant(serverAddr string) *Participant

NewParticipant returns started Participant

func (*Participant) Request

func (a *Participant) Request(operation *transparent.Message) (*transparent.Message, error)

Request send request to Coodinator

func (*Participant) SetCallback

func (a *Participant) SetCallback(committer func(m *transparent.Message) (*transparent.Message, error)) error

func (*Participant) SetTimeout

func (a *Participant) SetTimeout(millisecond time.Duration)

SetTimeout change timeout default is 1000 milliseconds

func (*Participant) Start

func (a *Participant) Start() error

func (*Participant) Stop

func (a *Participant) Stop() error

Directories

Path Synopsis
Package twopcpb is a generated protocol buffer package.
Package twopcpb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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