capabilities

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheCapability

type CacheCapability interface {
	NodeCapability
	Role() CacheRole
}

CacheCapability is a NodeCapability that also exposes cache helpers.

type CacheRole

type CacheRole string

CacheRole represents the intended owner of the cache capability.

const (
	// CacheRoleRequest is used by request nodes to maintain MESI states.
	CacheRoleRequest CacheRole = "request"
	// CacheRoleHome is used by home nodes to maintain simple cache lines.
	CacheRoleHome CacheRole = "home"
)

type CacheWithHomeStore

type CacheWithHomeStore interface {
	CacheCapability
	HomeCache() HomeCache
}

CacheWithHomeStore adds home cache accessors.

func NewHomeCacheCapability

func NewHomeCacheCapability(name string) CacheWithHomeStore

type CacheWithRequestStore

type CacheWithRequestStore interface {
	CacheCapability
	RequestCache() RequestCache
}

CacheWithRequestStore adds request cache accessors.

func NewMESICacheCapability

func NewMESICacheCapability(name string) CacheWithRequestStore

type DirectoryCapability

type DirectoryCapability interface {
	NodeCapability
	Directory() DirectoryStore
}

DirectoryCapability provides address-to-node tracking for coherence.

func NewDirectoryCapability

func NewDirectoryCapability(name string) DirectoryCapability

NewDirectoryCapability creates a capability maintaining sharer lists per address.

type DirectoryStore

type DirectoryStore interface {
	Add(address uint64, nodeID int)
	Remove(address uint64, nodeID int)
	Sharers(address uint64) []int
	Clear(address uint64)
	Reset()
}

DirectoryStore exposes operations for managing sharer sets.

type HomeCache

type HomeCache interface {
	GetLine(addr uint64) (HomeCacheLine, bool)
	UpdateLine(addr uint64, line HomeCacheLine)
	Invalidate(addr uint64)
	Clear()
}

HomeCache exposes cache helpers for HomeNode.

type HomeCacheLine

type HomeCacheLine struct {
	Address  uint64
	Valid    bool
	Metadata map[string]string
}

HomeCacheLine represents cache metadata maintained by HomeNode.

type NodeCapability

type NodeCapability interface {
	Descriptor() hooks.PluginDescriptor
	Register(broker *hooks.PluginBroker) error
}

NodeCapability represents a self-contained behaviour that can attach hooks to the broker.

func NewFlowControlCapability

func NewFlowControlCapability(name string, mgr policy.Manager) NodeCapability

NewFlowControlCapability returns a capability that performs flow control using policy.Manager.

func NewHookCapability

func NewHookCapability(name string, category hooks.PluginCategory, description string, bundle hooks.HookBundle) NodeCapability

NewHookCapability builds a capability from an arbitrary set of hook handlers.

func NewRoutingCapability

func NewRoutingCapability(name string, mgr policy.Manager) NodeCapability

NewRoutingCapability returns a capability that resolves routes using policy.Manager.

type PacketAllocator

type PacketAllocator func() (int64, error)

PacketAllocator allocates unique packet IDs.

type RequestCache

type RequestCache interface {
	GetState(addr uint64) core.MESIState
	SetState(addr uint64, state core.MESIState)
	Invalidate(addr uint64)
	Clear()
}

RequestCache exposes MESI cache helpers for RequestNode.

type RequestCacheHandler

type RequestCacheHandler interface {
	CacheWithRequestStore
	HandleResponse(packet *core.Packet)
	BuildSnoopResponse(nodeID int, req *core.Packet, alloc PacketAllocator, cycle int) (*core.Packet, error)
}

RequestCacheHandler adds high-level helpers for RequestNode cache behaviour.

type TransactionCapability

type TransactionCapability interface {
	NodeCapability
	Creator() TransactionCreator
}

TransactionCapability exposes a creator function for request nodes.

func NewDefaultTransactionCapability

func NewDefaultTransactionCapability(
	name string,
	allocate func() (int64, error),
	createTxn func(core.CHITransactionType, uint64, int) *core.Transaction,
) TransactionCapability

NewDefaultTransactionCapability builds a capability using allocator/transaction providers.

func NewTransactionCapability

func NewTransactionCapability(name string, creator TransactionCreator) TransactionCapability

NewTransactionCapability wraps a creator function into a NodeCapability.

type TransactionCreator

type TransactionCreator func(params TxRequestParams) (*core.Packet, *core.Transaction, error)

TransactionCreator builds request packets along with transactions.

type TxRequestParams

type TxRequestParams struct {
	Cycle           int
	SrcID           int
	MasterID        int
	DstID           int
	TransactionType core.CHITransactionType
	Address         uint64
	DataSize        int
	ParentPacketID  int64
}

TxRequestParams describes the information needed to build a request packet.

Jump to

Keyboard shortcuts

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