Documentation
¶
Overview ¶
Package subnet contains implementation of Subnet contract deployed in NeoFS sidechain.
Subnet contract stores and manages NeoFS 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
- func AddClientAdmin(subnetID []byte, groupID []byte, adminPublicKey interop.PublicKey)
- func AddNode(subnetID []byte, node interop.PublicKey)
- func AddNodeAdmin(subnetID []byte, adminKey interop.PublicKey)
- func AddUser(subnetID []byte, groupID []byte, userID []byte)
- func Delete(id []byte)
- func Get(id []byte) []byte
- func NodeAllowed(subnetID []byte, node interop.PublicKey) bool
- func Put(id []byte, ownerKey interop.PublicKey, info []byte)
- func RemoveClientAdmin(subnetID []byte, groupID []byte, adminPublicKey interop.PublicKey)
- func RemoveNode(subnetID []byte, node interop.PublicKey)
- func RemoveNodeAdmin(subnetID []byte, adminKey interop.PublicKey)
- func RemoveUser(subnetID []byte, groupID []byte, userID []byte)
- func Update(script []byte, manifest []byte, data interface{})
- func UserAllowed(subnetID []byte, user []byte) bool
- func Version() int
Constants ¶
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 ¶
AddClientAdmin adds a new client administrator of the specified group in the specified subnetwork. Must be called by the owner only.
func AddNode ¶
AddNode adds a node to the specified subnetwork. Must be called by the subnet's owner or the node administrator only.
func AddNodeAdmin ¶
AddNodeAdmin adds a new node administrator to the specified subnetwork.
func AddUser ¶
AddUser adds user to the specified subnetwork and group. Must be called by the owner or the group's admin only.
func NodeAllowed ¶
NodeAllowed checks if a node is included in the specified subnet.
func RemoveClientAdmin ¶
RemoveClientAdmin removes client administrator from the specified group in the specified subnetwork. Must be called by the owner only.
func RemoveNode ¶
RemoveNode removes a node from the specified subnetwork. Must be called by the subnet's owner or the node administrator only.
func RemoveNodeAdmin ¶
RemoveNodeAdmin removes node administrator from the specified subnetwork. Must be called by the subnet owner only.
func RemoveUser ¶
RemoveUser removes a user from the specified subnetwork and group. Must be called by the owner or the group's admin only.
func Update ¶
Update method updates contract source code and manifest. It can be invoked only by committee.
func UserAllowed ¶
UserAllowed returns bool that indicates if a node is included in the specified subnet.
Types ¶
This section is empty.