network

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReadFailed = "read failed due to unknown txn status"
)

Variables

View Source
var HttpClient = &http.Client{
	Transport: &http.Transport{
		MaxIdleConns:        6000,
		MaxIdleConnsPerHost: 1000,
		MaxConnsPerHost:     1000,
	},
}

Functions

This section is empty.

Types

type AbortRequest

type AbortRequest struct {
	DsName  string
	KeyList []string
	TxnId   string
}

type Client

type Client struct {
	ServerAddrList []string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(serverAddrList []string) *Client

func (*Client) Abort

func (c *Client) Abort(dsName string, keyList []string, txnId string) error

func (*Client) Commit

func (c *Client) Commit(dsName string, infoList []txn.CommitInfo) error

func (*Client) GetServerAddr

func (c *Client) GetServerAddr() string

func (*Client) Prepare

func (c *Client) Prepare(dsName string, itemList []txn.DataItem,
	startTime time.Time, commitTime time.Time,
	cfg txn.RecordConfig, validationMap map[string]txn.PredicateInfo) (map[string]string, error)

func (*Client) Read

func (c *Client) Read(dsName string, key string, ts time.Time, cfg txn.RecordConfig) (txn.DataItem, txn.RemoteDataStrategy, error)

type CommitRequest

type CommitRequest struct {
	DsName string
	List   []txn.CommitInfo
}

type Committer

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

func NewCommitter

func NewCommitter(connMap map[string]txn.Connector, se serializer.Serializer, itemFactory txn.DataItemFactory) *Committer

func (*Committer) Abort

func (c *Committer) Abort(dsName string, keyList []string, txnId string) error

func (*Committer) Commit

func (c *Committer) Commit(dsName string, infoList []txn.CommitInfo) error

func (*Committer) Prepare

func (c *Committer) Prepare(dsName string, itemList []txn.DataItem,
	startTime time.Time, commitTime time.Time,
	cfg txn.RecordConfig, validateMap map[string]txn.PredicateInfo) (map[string]string, error)

type PrepareRequest

type PrepareRequest struct {
	DsName        string
	ValidationMap map[string]txn.PredicateInfo
	ItemType      txn.ItemType
	ItemList      []txn.DataItem
	StartTime     time.Time
	CommitTime    time.Time
	Config        txn.RecordConfig
}

func (*PrepareRequest) UnmarshalJSON

func (p *PrepareRequest) UnmarshalJSON(data []byte) error

type ReadRequest

type ReadRequest struct {
	DsName    string
	Key       string
	StartTime time.Time
	Config    txn.RecordConfig
}

type ReadResponse

type ReadResponse struct {
	Status       string
	ErrMsg       string
	DataStrategy txn.RemoteDataStrategy
	ItemType     txn.ItemType
	Data         txn.DataItem
}

func (*ReadResponse) UnmarshalJSON

func (r *ReadResponse) UnmarshalJSON(data []byte) error

type Reader

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

func NewReader

func NewReader(connMap map[string]txn.Connector, itemFactory txn.DataItemFactory, se serializer.Serializer) *Reader

func (*Reader) Read

func (r *Reader) Read(dsName string, key string, ts time.Time, cfg txn.RecordConfig,
	isRemoteCall bool) (txn.DataItem, txn.RemoteDataStrategy, error)

If the record is marked as IsDeleted, this function will return it.

Let the upper layer decide what to do with it

type Response

type Response[T any] struct {
	Status string
	ErrMsg string
	Data   T
}

Jump to

Keyboard shortcuts

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