kv

package
v0.0.0-...-2e7796a Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetRequestType = iota + 1
	PutRequestType
)

Variables

View Source
var AClient = distsys.MPCalArchetype{
	Name:              "AClient",
	Label:             "AClient.clientLoop",
	RequiredRefParams: []string{"AClient.net", "AClient.netLen", "AClient.fd", "AClient.reqCh", "AClient.respCh", "AClient.timeout"},
	RequiredValParams: []string{},
	JumpTable:         jumpTable,
	ProcTable:         procTable,
	PreAmble: func(iface distsys.ArchetypeInterface) {
		iface.EnsureArchetypeResourceLocal("AClient.server", Nil(iface))
		iface.EnsureArchetypeResourceLocal("AClient.req", tla.Value{})
		iface.EnsureArchetypeResourceLocal("AClient.reqIdx", tla.MakeNumber(0))
		iface.EnsureArchetypeResourceLocal("AClient.resp", tla.Value{})
	},
}
View Source
var AServerAcct = distsys.MPCalArchetype{
	Name:              "AServerAcct",
	Label:             "AServerAcct.serverAccLoop",
	RequiredRefParams: []string{"AServerAcct.net", "AServerAcct.acctCh"},
	RequiredValParams: []string{"AServerAcct.srvId"},
	JumpTable:         jumpTable,
	ProcTable:         procTable,
	PreAmble: func(iface distsys.ArchetypeInterface) {
		iface.EnsureArchetypeResourceLocal("AServerAcct.m", tla.Value{})
		iface.EnsureArchetypeResourceLocal("AServerAcct.sm", tla.MakeFunction([]tla.Value{KeySet(iface)}, func(args []tla.Value) tla.Value {
			var k tla.Value = args[0]
			_ = k
			return Nil(iface)
		}))
		iface.EnsureArchetypeResourceLocal("AServerAcct.smDomain", KeySet(iface))
	},
}
View Source
var AServerProp = distsys.MPCalArchetype{
	Name:              "AServerProp",
	Label:             "AServerProp.serverPropLoop",
	RequiredRefParams: []string{"AServerProp.net", "AServerProp.propCh"},
	RequiredValParams: []string{"AServerProp.srvId"},
	JumpTable:         jumpTable,
	ProcTable:         procTable,
	PreAmble: func(iface distsys.ArchetypeInterface) {
	},
}

Functions

func AcceptMessage

func AcceptMessage(iface distsys.ArchetypeInterface) tla.Value

func ClientGetRequest

func ClientGetRequest(iface distsys.ArchetypeInterface) tla.Value

func ClientGetResponse

func ClientGetResponse(iface distsys.ArchetypeInterface) tla.Value

func ClientPutRequest

func ClientPutRequest(iface distsys.ArchetypeInterface) tla.Value

func ClientPutResponse

func ClientPutResponse(iface distsys.ArchetypeInterface) tla.Value

func ClientSet

func ClientSet(iface distsys.ArchetypeInterface) tla.Value

func Get

func Key1

func Key1(iface distsys.ArchetypeInterface) tla.Value

func Key2

func Key2(iface distsys.ArchetypeInterface) tla.Value

func KeySet

func KeySet(iface distsys.ArchetypeInterface) tla.Value

func Nil

func NodeSet

func NodeSet(iface distsys.ArchetypeInterface) tla.Value

func ProposeMessage

func ProposeMessage(iface distsys.ArchetypeInterface) tla.Value

func Put

func ResetClientFailureDetector

func ResetClientFailureDetector()

func ServerAcctSet

func ServerAcctSet(iface distsys.ArchetypeInterface) tla.Value

func ServerPropSet

func ServerPropSet(iface distsys.ArchetypeInterface) tla.Value

func ServerSet

func ServerSet(iface distsys.ArchetypeInterface) tla.Value

func Value1

func Value1(iface distsys.ArchetypeInterface) tla.Value

Types

type Client

type Client struct {
	Id     int
	Config configs.Root
	// contains filtered or unexported fields
}

func NewClient

func NewClient(clientId int, c configs.Root) *Client

func (*Client) Close

func (c *Client) Close() error

func (*Client) Run

func (c *Client) Run(reqCh chan Request, respCh chan Response) error

type GetRequest

type GetRequest struct {
	Key string
}

func (GetRequest) String

func (r GetRequest) String() string

func (GetRequest) Type

func (r GetRequest) Type() RequestType

type PutRequest

type PutRequest struct {
	Key   string
	Value string
}

func (PutRequest) String

func (r PutRequest) String() string

func (PutRequest) Type

func (r PutRequest) Type() RequestType

type Request

type Request interface {
	Type() RequestType
	String() string
}

type RequestType

type RequestType int

type Response

type Response struct {
	Index int
	OK    bool
	Key   string
	Value string
}

func (Response) String

func (r Response) String() string

type Server

type Server struct {
	Id     int
	Config configs.Root
	// contains filtered or unexported fields
}

func NewServer

func NewServer(srvId int, c configs.Root, mon *resources.Monitor, propCh, acctCh chan tla.Value) *Server

func (*Server) Close

func (s *Server) Close() error

func (*Server) Run

func (s *Server) Run() error

Jump to

Keyboard shortcuts

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