types

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidConfig is returned when configuration is invalid
	ErrInvalidConfig = errors.New("invalid configuration")

	// ErrNotFound is returned when a resource is not found
	ErrNotFound = errors.New("not found")

	// ErrTimeout is returned when an operation times out
	ErrTimeout = errors.New("operation timed out")

	// ErrInvalidSignature is returned when a signature is invalid
	ErrInvalidSignature = errors.New("invalid signature")

	// ErrTaskFailed is returned when a task fails
	ErrTaskFailed = errors.New("task failed")
)

Functions

func GetLatestIPAddress

func GetLatestIPAddress(history []*supernodetypes.IPAddressHistory) string

GetLatestIPAddress extracts the IP address with the highest height from IPAddressHistory

func GetLatestState

GetLatestState extracts the state with the highest height from SuperNodeStateRecord

Types

type Action

type Action struct {
	ID             string
	Creator        string
	AppPubkey      []byte
	Type           ActionType
	State          ActionState
	Metadata       ActionMetadata
	Price          string
	ExpirationTime time.Time
	BlockHeight    int64
	FileSizeKbs    int64
	SuperNodes     []string
}

Action represents an action in the SDK

func ActionFromProto

func ActionFromProto(pb *actiontypes.Action) *Action

ActionFromProto converts a proto action to SDK action

type ActionMetadata

type ActionMetadata interface {
	Type() ActionType
}

ActionMetadata is an interface for different action metadata types

type ActionResult

type ActionResult struct {
	ActionID string
	TxHash   string
	Height   int64
}

ActionResult contains the result of an action registration

type ActionState

type ActionState string

ActionState represents the state of an action

const (
	ActionStatePending    ActionState = "ACTION_STATE_PENDING"
	ActionStateProcessing ActionState = "ACTION_STATE_PROCESSING"
	ActionStateDone       ActionState = "ACTION_STATE_DONE"
	ActionStateApproved   ActionState = "ACTION_STATE_APPROVED"
	ActionStateFailed     ActionState = "ACTION_STATE_FAILED"
	ActionStateExpired    ActionState = "ACTION_STATE_EXPIRED"
)

type ActionType

type ActionType string

ActionType represents the type of action

const (
	ActionTypeCascade ActionType = "CASCADE"
	ActionTypeSense   ActionType = "SENSE"
)

type CascadeMetadata

type CascadeMetadata struct {
	DataHash   string
	FileName   string
	RQIDsIC    uint64
	RQIDsMax   uint64
	RQIDsIDs   []string
	Signatures string
	Public     bool
}

CascadeMetadata contains cascade-specific metadata

func (*CascadeMetadata) Type

func (m *CascadeMetadata) Type() ActionType

type CascadeResult

type CascadeResult struct {
	ActionResult
	TaskID string
}

CascadeResult contains the result of a cascade operation

type DownloadResult

type DownloadResult struct {
	ActionID   string
	TaskID     string
	OutputPath string
}

DownloadResult contains the result of a download operation

type SenseMetadata

type SenseMetadata struct {
	DataHash             string
	CollectionID         string
	GroupID              string
	DDAndFingerprintsIC  uint64
	DDAndFingerprintsMax uint64
	DDAndFingerprintsIDs []string
	Signatures           string
}

SenseMetadata contains sense-specific metadata

func (*SenseMetadata) Type

func (m *SenseMetadata) Type() ActionType

type SuperNode

type SuperNode struct {
	ValidatorAddress string
	IPAddress        string
	State            string
}

SuperNode represents a supernode in the SDK

func SuperNodeFromProto

func SuperNodeFromProto(pb *supernodetypes.SuperNode) *SuperNode

SuperNodeFromProto converts a proto supernode to SDK supernode

Jump to

Keyboard shortcuts

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