clock

package
v0.0.0-...-f6126b0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock struct {
	Coordinator *membership.CoordinatorClientSet
	Members     *membership.Pool
}

Clock implements the meta cluster's logic clock. It allows the meta cluster to preserve Happens-Before semantics between keys that span two etcd clusters.

func (*Clock) Init

func (c *Clock) Init() error

func (*Clock) MungeEvents

func (c *Clock) MungeEvents(events []*clientv3.Event) (int64, []*mvccpb.Event, bool)

func (*Clock) MungeRangeResp

func (c *Clock) MungeRangeResp(resp *etcdserverpb.RangeResponse)

func (*Clock) MungeTxn

func (c *Clock) MungeTxn(metaRev int64, req *etcdserverpb.TxnRequest)

func (*Clock) MungeTxnResp

func (c *Clock) MungeTxnResp(metaRev int64, resp *etcdserverpb.TxnResponse)

func (*Clock) Now

func (c *Clock) Now(ctx context.Context) (int64, error)

Now returns the cluster's current timestamp/revision.

func (*Clock) Reset

func (c *Clock) Reset(ctx context.Context) error

Reset deletes the coordinator's account of the current time.

func (*Clock) ResolveMetaToMember

func (c *Clock) ResolveMetaToMember(ctx context.Context, client *membership.ClientSet, metaRev int64) (int64, error)

ResolveMetaToMember finds at least the corresponding member revision for a given meta revision.

func (*Clock) ResolveMetaToMemberTxn

func (c *Clock) ResolveMetaToMemberTxn(ctx context.Context, client *membership.ClientSet, key []byte, metaRev int64, req *etcdserverpb.TxnRequest) (int64, *etcdserverpb.TxnResponse, error)

ResolveMetaToMemberTxn returns the member revision that corresponds with a given transaction operation. If the given meta revision doesn't match a value's current revision, an error response is returned instead. If the transaction includes a get operation for the same key, a conforming response is returned. This implements an odd but essential set of behaviors that make Kubernetes's etcd store work.

func (*Clock) Tick

func (c *Clock) Tick(ctx context.Context) (int64, error)

Tick increments and returns the cluster's current timestamp/revision.

func (*Clock) ValidateTxn

func (c *Clock) ValidateTxn(req *etcdserverpb.TxnRequest) ([]byte, error)

Jump to

Keyboard shortcuts

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