service

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TxnService

type TxnService interface {
	// Shard returns the metadata of DNShard
	Shard() metadata.DNShard
	// Start start the txn service
	Start() error
	// Close close the txn service
	Close() error

	// Read handle txn read request from CN. For reuse, the response is provided by the
	// TODO: only read log tail.
	Read(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
	// Write handle txn write request from CN. For reuse, the response is provided by the caller
	Write(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
	// Commit handle txn commit request from CN. For reuse, the response is provided by the caller
	Commit(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
	// Rollback handle txn rollback request from CN. For reuse, the response is provided by the caller
	Rollback(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error

	// Prepare handle txn prepare request from coordinator DN. For reuse, the response is provided by
	// the caller
	Prepare(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
	// GetStatus handle get txn status in current DNShard request from coordinator DN. For reuse, the
	// response is provided by the caller.
	GetStatus(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
	// CommitDNShard handle commit txn data in current DNShard request from coordinator DN. For reuse, the
	// response is provided by the caller.
	CommitDNShard(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
	// RollbackDNShard handle rollback txn data in current DNShard request from coordinator DN. For reuse,
	// the response is provided by the caller.
	RollbackDNShard(ctx context.Context, request *txn.TxnRequest, response *txn.TxnResponse) error
}

TxnService is a transaction service that runs on the DNStore and is used to receive transaction requests from the CN. In the case of a 2 pc distributed transaction, it acts as a transaction coordinator to handle distributed transactions.

The TxnService is managed by the DNStore and a TxnService serves only one DNShard.

The txn service use Clock-SI to implement distributed transaction.

func NewTxnService added in v0.5.1

func NewTxnService(logger *zap.Logger,
	shard metadata.DNShard,
	storage storage.TxnStorage,
	sender rpc.TxnSender,
	clocker clock.Clock,
	zombieTimeout time.Duration) TxnService

NewTxnService create TxnService

Jump to

Keyboard shortcuts

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