audit

package
v0.0.0-...-bb55e7d Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Overview

Package audit provides features to process data audit in NeoFS system.

Result type groups values which can be gathered during data audit process.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectMembers

func CollectMembers(
	ctx context.Context,
	collector relations.Executor,
	cnr cid.ID,
	members []oid.ID,
	tokens relations.Tokens,
	calcHomoHash bool,
	signer user.Signer,
) (*storagegroup.StorageGroup, error)

CollectMembers creates new storage group structure and fills it with information about members collected via HeadReceiver.

Resulting storage group consists of physically stored objects only.

Types

type Result

type Result struct {
	// contains filtered or unexported fields
}

Result represents report on the results of the data audit in NeoFS system.

Result is mutually binary-compatible with github.com/epicchainlabs/epicchain-api-go/v2/audit.DataAuditResult message. See Marshal / Unmarshal methods.

Instances can be created using built-in var declaration.

Example
package main

import (
	"github.com/epicchainlabs/epicchain-sdk-go/audit"
	cid "github.com/epicchainlabs/epicchain-sdk-go/container/id"
)

func main() {
	var res audit.Result
	var cnr cid.ID

	res.ForEpoch(32)
	res.ForContainer(cnr)
	// ...
	res.Complete()

	// Result instances can be stored in a binary format on client side.
	data := res.Marshal()

	// ...

	// Result instances can be restored from a binary format on server side.
	var auditResult audit.Result
	_ = auditResult.Unmarshal(data)
}
Output:

func (Result) AuditorKey

func (r Result) AuditorKey() []byte

AuditorKey returns public key of the auditing NeoFS Inner Ring node in a NeoFS binary key format.

Zero Result has nil key.

The value returned shares memory with the structure itself, so changing it can lead to data corruption. Make a copy if you need to change it.

The resulting slice of bytes is a serialized compressed public key. See [elliptic.MarshalCompressed]. Use [neofsecdsa.PublicKey.Decode] to decode it into a type-specific structure.

See also Result.SetAuditorKey.

func (*Result) Complete

func (r *Result) Complete()

Complete marks the data audit associated with the Result as completed.

See also Completed.

func (Result) Completed

func (r Result) Completed() bool

Completed returns completion state of the data audit associated with the Result.

Zero Result corresponds to incomplete data audit.

See also Complete.

func (Result) Container

func (r Result) Container() (cid.ID, bool)

Container returns identifier of the container with which the data audit Result is associated and a bool that indicates container ID field presence in the Result.

Zero Result does not have container ID.

See also ForContainer.

func (Result) Epoch

func (r Result) Epoch() uint64

Epoch returns NeoFS epoch when the data associated with the Result was audited.

Zero Result has zero epoch.

See also ForEpoch.

func (Result) Failures

func (r Result) Failures() uint32

Failures returns number of sampled objects under audit stored in a way not confirming placement policy or not found at all when checking Proof-of-Placement.

Zero result has zero failures.

See also SetFailures.

func (*Result) ForContainer

func (r *Result) ForContainer(cnr cid.ID)

ForContainer sets identifier of the container with which the data audit Result is associated.

See also Container.

func (*Result) ForEpoch

func (r *Result) ForEpoch(epoch uint64)

ForEpoch specifies NeoFS epoch when the data associated with the Result was audited.

See also Epoch.

func (Result) Hits

func (r Result) Hits() uint32

Hits returns number of sampled objects under audit placed in an optimal way according to the container's placement policy when checking Proof-of-Placement.

Zero result has zero hits.

See also SetHits.

func (Result) IterateFailedStorageGroups

func (r Result) IterateFailedStorageGroups(f func(oid.ID) bool)

IterateFailedStorageGroups is similar to IteratePassedStorageGroups but for failed groups.

See also SubmitFailedStorageGroup.

func (Result) IterateFailedStorageNodes

func (r Result) IterateFailedStorageNodes(f func([]byte) bool)

IterateFailedStorageNodes is similar to IteratePassedStorageNodes but for failed nodes.

See also SubmitPassedStorageNodes.

func (Result) IteratePassedStorageGroups

func (r Result) IteratePassedStorageGroups(f func(oid.ID) bool)

IteratePassedStorageGroups iterates over all storage groups that passed Proof-of-Retrievability audit check and passes them into f. Breaks on f's false return, f MUST NOT be nil.

Zero Result has no passed storage groups and doesn't call f.

See also SubmitPassedStorageGroup.

func (Result) IteratePassedStorageNodes

func (r Result) IteratePassedStorageNodes(f func([]byte) bool)

IteratePassedStorageNodes iterates over all storage nodes that passed at least one Proof-of-Data-Possession audit check and passes their public keys into f. Breaks on f's false return.

f MUST NOT be nil and MUST NOT mutate parameter passed into it at least until the end of using the Result.

Zero Result has no passed storage nodes and doesn't call f.

See also SubmitPassedStorageNode.

func (*Result) Marshal

func (r *Result) Marshal() []byte

Marshal encodes Result into a canonical NeoFS binary format (Protocol Buffers with direct field order).

Writes version.Current() protocol version into the resulting message if Result hasn't been already decoded from such a message using Unmarshal.

See also Unmarshal.

func (Result) Misses

func (r Result) Misses() uint32

Misses returns number of sampled objects under audit placed in suboptimal way according to the container's placement policy, but still at a satisfactory level when checking Proof-of-Placement.

Zero Result has zero misses.

See also SetMisses.

func (Result) RequestsPoR

func (r Result) RequestsPoR() uint32

RequestsPoR returns number of requests made by Proof-of-Retrievability audit check to get all headers of the objects inside storage groups.

Zero Result has zero requests.

See also SetRequestsPoR.

func (Result) RetriesPoR

func (r Result) RetriesPoR() uint32

RetriesPoR returns number of retries made by Proof-of-Retrievability audit check to get all headers of the objects inside storage groups.

Zero Result has zero retries.

See also SetRetriesPoR.

func (*Result) SetAuditorKey

func (r *Result) SetAuditorKey(key []byte)

SetAuditorKey specifies public key of the auditing NeoFS Inner Ring node in a NeoFS binary key format.

Argument MUST NOT be mutated at least until the end of using the Result.

Parameter key is a serialized compressed public key. See [elliptic.MarshalCompressed].

See also Result.AuditorKey.

func (*Result) SetFailures

func (r *Result) SetFailures(fail uint32)

SetFailures sets number of sampled objects under audit stored in a way not confirming placement policy or not found at all when checking Proof-of-Placement.

See also Failures.

func (*Result) SetHits

func (r *Result) SetHits(hit uint32)

SetHits sets number of sampled objects under audit placed in an optimal way according to the containers placement policy when checking Proof-of-Placement.

See also Hits.

func (*Result) SetMisses

func (r *Result) SetMisses(miss uint32)

SetMisses sets number of sampled objects under audit placed in suboptimal way according to the container's placement policy, but still at a satisfactory level when checking Proof-of-Placement.

See also Misses.

func (*Result) SetRequestsPoR

func (r *Result) SetRequestsPoR(v uint32)

SetRequestsPoR sets number of requests made by Proof-of-Retrievability audit check to get all headers of the objects inside storage groups.

See also RequestsPoR.

func (*Result) SetRetriesPoR

func (r *Result) SetRetriesPoR(v uint32)

SetRetriesPoR sets number of retries made by Proof-of-Retrievability audit check to get all headers of the objects inside storage groups.

See also RetriesPoR.

func (*Result) SubmitFailedStorageGroup

func (r *Result) SubmitFailedStorageGroup(sg oid.ID)

SubmitFailedStorageGroup is similar to SubmitPassedStorageGroup but for failed groups.

See also IterateFailedStorageGroups.

func (*Result) SubmitFailedStorageNodes

func (r *Result) SubmitFailedStorageNodes(list [][]byte)

SubmitFailedStorageNodes is similar to SubmitPassedStorageNodes but for failed nodes.

See also IterateFailedStorageNodes.

func (*Result) SubmitPassedStorageGroup

func (r *Result) SubmitPassedStorageGroup(sg oid.ID)

SubmitPassedStorageGroup marks storage group as passed Proof-of-Retrievability audit check.

See also IteratePassedStorageGroups.

func (*Result) SubmitPassedStorageNodes

func (r *Result) SubmitPassedStorageNodes(list [][]byte)

SubmitPassedStorageNodes marks storage node list as passed Proof-of-Data-Possession audit check. The list contains public keys.

Argument and its elements MUST NOT be mutated at least until the end of using the Result.

See also IteratePassedStorageNodes.

func (*Result) Unmarshal

func (r *Result) Unmarshal(data []byte) error

Unmarshal decodes Result from its canonical NeoFS binary format (Protocol Buffers with direct field order). Returns an error describing a format violation.

See also Marshal.

Directories

Path Synopsis
Package audittest provides functions for convenient testing of audit package API.
Package audittest provides functions for convenient testing of audit package API.

Jump to

Keyboard shortcuts

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