subnet

package
v0.0.0-...-4f3c08f Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Subnet contract is a contract deployed in FrostFS sidechain.

Subnet contract stores and manages FrostFS subnetwork states. It allows registering and deleting subnetworks, limiting access to them, and defining a list of the Storage Nodes that can be included in them.

Contract notifications

Put notification. This notification is produced when a new subnetwork is registered by invoking Put method.

Put
  - name: id
    type: ByteArray
  - name: ownerKey
    type: PublicKey
  - name: info
    type: ByteArray

Delete notification. This notification is produced when some subnetwork is deleted by invoking Delete method.

Delete
  - name: id
    type: ByteArray

RemoveNode notification. This notification is produced when some node is deleted by invoking RemoveNode method.

RemoveNode
  - name: subnetID
    type: ByteArray
  - name: node
    type: PublicKey

Index

Constants

View Source
const (
	// ErrInvalidSubnetID is thrown when subnet id is not a slice of 5 bytes.
	ErrInvalidSubnetID = "invalid subnet ID"
	// ErrInvalidGroupID is thrown when group id is not a slice of 5 bytes.
	ErrInvalidGroupID = "invalid group ID"
	// ErrInvalidOwner is thrown when owner has invalid format.
	ErrInvalidOwner = "invalid owner"
	// ErrInvalidAdmin is thrown when admin has invalid format.
	ErrInvalidAdmin = "invalid administrator"
	// ErrAlreadyExists is thrown when id already exists.
	ErrAlreadyExists = "subnet id already exists"
	// ErrNotExist is thrown when id doesn't exist.
	ErrNotExist = "subnet id doesn't exist"
	// ErrInvalidUser is thrown when user has invalid format.
	ErrInvalidUser = "invalid user"
	// ErrInvalidNode is thrown when node has invalid format.
	ErrInvalidNode = "invalid node key"
	// ErrNodeAdmNotExist is thrown when node admin is not found.
	ErrNodeAdmNotExist = "node admin not found"
	// ErrClientAdmNotExist is thrown when client admin is not found.
	ErrClientAdmNotExist = "client admin not found"
	// ErrNodeNotExist is thrown when node is not found.
	ErrNodeNotExist = "node not found"
	// ErrUserNotExist is thrown when user is not found.
	ErrUserNotExist = "user not found"
	// ErrAccessDenied is thrown when operation is denied for caller.
	ErrAccessDenied = "access denied"
)

Variables

This section is empty.

Functions

func AddClientAdmin

func AddClientAdmin(subnetID []byte, groupID []byte, adminPublicKey interop.PublicKey)

AddClientAdmin adds a new client administrator of the specified group in the specified subnetwork. Must be called by the owner only.

func AddNode

func AddNode(subnetID []byte, node interop.PublicKey)

AddNode adds a node to the specified subnetwork. Must be called by the subnet's owner or the node administrator only.

func AddNodeAdmin

func AddNodeAdmin(subnetID []byte, adminKey interop.PublicKey)

AddNodeAdmin adds a new node administrator to the specified subnetwork.

func AddUser

func AddUser(subnetID []byte, groupID []byte, userID []byte)

AddUser adds user to the specified subnetwork and group. Must be called by the owner or the group's admin only.

func Delete

func Delete(id []byte)

Delete deletes the subnet with the specified id.

func Get

func Get(id []byte) []byte

Get returns info about the subnet with the specified id.

func NodeAllowed

func NodeAllowed(subnetID []byte, node interop.PublicKey) bool

NodeAllowed checks if a node is included in the specified subnet.

func Put

func Put(id []byte, ownerKey interop.PublicKey, info []byte)

Put creates a new subnet with the specified owner and info.

func RemoveClientAdmin

func RemoveClientAdmin(subnetID []byte, groupID []byte, adminPublicKey interop.PublicKey)

RemoveClientAdmin removes client administrator from the specified group in the specified subnetwork. Must be called by the owner only.

func RemoveNode

func RemoveNode(subnetID []byte, node interop.PublicKey)

RemoveNode removes a node from the specified subnetwork. Must be called by the subnet's owner or the node administrator only.

func RemoveNodeAdmin

func RemoveNodeAdmin(subnetID []byte, adminKey interop.PublicKey)

RemoveNodeAdmin removes node administrator from the specified subnetwork. Must be called by the subnet owner only.

func RemoveUser

func RemoveUser(subnetID []byte, groupID []byte, userID []byte)

RemoveUser removes a user from the specified subnetwork and group. Must be called by the owner or the group's admin only.

func Update

func Update(script []byte, manifest []byte, data interface{})

Update method updates contract source code and manifest. It can be invoked only by committee.

func UserAllowed

func UserAllowed(subnetID []byte, user []byte) bool

UserAllowed returns bool that indicates if a node is included in the specified subnet.

func Version

func Version() int

Version returns the version of the contract.

Types

This section is empty.

Jump to

Keyboard shortcuts

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