address

package
v0.0.0-...-f3a906b Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type AddressRef

type AddressRef string

AddressRef structure: /<collaboration_id>/<collaborator_name>/<address_type>/<address_name> <collaboration_id>: will not come into play until we enter support multiple collaborations at the same time. <collaboration_id>: <collaboration_name>_HASH

func Abs

func Abs(addressName string, collaboratorName string, addType AddressType) AddressRef

This function will take in the name of the address and the name of the collaborator and return the absolute addressRef

func NewCollaboratorRef

func NewCollaboratorRef(collaboratorName string) AddressRef

func (AddressRef) Collaborator

func (a AddressRef) Collaborator() AddressRef

func (AddressRef) IsDestination

func (a AddressRef) IsDestination() bool

func (AddressRef) IsSource

func (a AddressRef) IsSource() bool

func (AddressRef) IsTransformation

func (a AddressRef) IsTransformation() bool

type AddressType

type AddressType string
const (
	ADDRESS_TYPE_ROOT           AddressType = "/"
	ADDRESS_TYPE_SOURCE         AddressType = "source/"
	ADDRESS_TYPE_DESTINATION    AddressType = "destination/"
	ADDRESS_TYPE_TRANSFORMATION AddressType = "transformation/"
)

func (AddressType) Name

func (a AddressType) Name() string

type DcrAddress

type DcrAddress interface {
	Authorize([]AddressRef, AddressRef) (bool, error) // Are we allowed to move further down the graph?
	//Deref  // Function that returns the real transformation
	Type() AddressType // Returns the type of Address.
}

All AddressNodeTypes must implement this interface

func NewDestinationAddress

func NewDestinationAddress(ref AddressRef, owner AddressRef, dest destination.Destination) DcrAddress

func NewSourceAddress

func NewSourceAddress(ref AddressRef, owner string, transformationOwnersAllowed []AddressRef, destAllowed []AddressRef, source source.Source, sourceNoises map[AddressRef]map[string]string) DcrAddress

func NewTransformationAddress

func NewTransformationAddress(ref AddressRef, owner string, destinationOwnersAllowed []AddressRef, destAllowed []AddressRef, t transformation.Transformation, noiseParams []string) DcrAddress

type DestinationAddress

type DestinationAddress struct {
	Ref         AddressRef
	Owner       AddressRef
	Destination destination.Destination
}

func (*DestinationAddress) Authorize

func (da *DestinationAddress) Authorize(_ []AddressRef, _ AddressRef) (bool, error)

func (*DestinationAddress) Type

func (da *DestinationAddress) Type() AddressType

type Graph

type Graph struct {
	Count                 int
	AdjacencyList         map[AddressRef][]AddressRef
	AuthorityStatus       map[AddressRef]bool
	CachedSources         map[AddressRef]DcrAddress
	CachedTransformations map[AddressRef]DcrAddress
	CachedDestinations    map[AddressRef]DcrAddress
}

func NewGraph

func NewGraph(cSources map[AddressRef]DcrAddress, cTransformations map[AddressRef]DcrAddress, cDestinations map[AddressRef]DcrAddress) (*Graph, error)

func (*Graph) AuthorizeAddress

func (g *Graph) AuthorizeAddress(root AddressRef) (bool, error)

A Destination is the ultimate requester of authorization. If a transformation is requesting authorization, it needs to have a list of associated parent destinations along with it. Otherwise, its an error.

func (*Graph) Authorizer

func (g *Graph) Authorizer(root AddressRef, parents []AddressRef, visited map[AddressRef]bool) (bool, error)

Helper function for AuthorizeAddress.

func (*Graph) GetOrderedRunnableRefs

func (g *Graph) GetOrderedRunnableRefs() ([]AddressRef, error)

type SourceAddress

type SourceAddress struct {
	Ref                         AddressRef
	Source                      source.Source
	Owner                       AddressRef //CollaboratorName
	TransformationOwnersAllowed []AddressRef
	DestinationsAllowed         []AddressRef
	SourceNoises                map[AddressRef]map[string]string
}

func (*SourceAddress) Authorize

func (sa *SourceAddress) Authorize(parents []AddressRef, root AddressRef) (bool, error)

Transformaton Owner is checked against Source TransformationOwnersAllowed. Destination owner is checked against Source DestinationsAllowed.

func (*SourceAddress) AuthorizeDestination

func (sa *SourceAddress) AuthorizeDestination(root AddressRef) (bool, error)

func (*SourceAddress) AuthorizeTransformation

func (sa *SourceAddress) AuthorizeTransformation(root AddressRef) (bool, error)

func (*SourceAddress) Type

func (sa *SourceAddress) Type() AddressType

type TopoOrder

type TopoOrder struct {
	List         []AddressRef
	IndegreeList map[AddressRef]int
}

func NewTopoOrder

func NewTopoOrder(adjList map[AddressRef][]AddressRef) *TopoOrder

func (*TopoOrder) AuthorizedSort

func (t *TopoOrder) AuthorizedSort(g *Graph) ([]AddressRef, error)

This function returns the topological order of all the addresses that are runnable in the current graph.

type TransformationAddress

type TransformationAddress struct {
	Ref                      AddressRef
	Owner                    AddressRef
	DestinationOwnersAllowed []AddressRef
	DestinationsAllowed      []AddressRef
	Transformation           transformation.Transformation
	NoiseParams              []string
}

func (*TransformationAddress) Authorize

func (ta *TransformationAddress) Authorize(parents []AddressRef, root AddressRef) (bool, error)

Destination Owners are to checked against transformation DestinationOwnersAllowed.

func (*TransformationAddress) AuthorizeDestination

func (ta *TransformationAddress) AuthorizeDestination(root AddressRef) (bool, error)

func (*TransformationAddress) Type

Directories

Path Synopsis
This package will have all the different types of destinations
This package will have all the different types of destinations
This package will have all the different types of sources
This package will have all the different types of sources
This package will contain transformation types
This package will contain transformation types

Jump to

Keyboard shortcuts

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