website

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChunkSize = 64_000 // 64KB
)

Variables

This section is empty.

Functions

func ComputeChunkCost

func ComputeChunkCost(chunkIndex int, chunkSize int) (int, error)

ComputeChunkCost computes the cost of uploading a chunk to a website. The cost is computed based on the size of the chunk and the index of the chunk. The cost of the first chunk includes the cost of nbChunk key creation.

TODO: This function should be updated to avoid sending coins for chunks that do not require it.

  • chunk X in storage has chunkSize bytes, so we should not send coins for it.
  • chunk X in storage has 30% of chunkSize bytes, so we should only the missing 70% of chunkSize bytes in coins.

func Delete

func Delete(scConfig *config.SCConfig,
	walletConfig config.WalletConfig,
	networkInfos *msConfig.NetworkInfos, address string,
) (*string, error)

func DivideIntoChunks

func DivideIntoChunks(data []byte, chunkSize int) [][]byte

func Fetch

func Fetch(network *config.NetworkInfos, websiteAddress string) ([]byte, error)

Fetch retrieves the complete data of a website as bytes.

func GetFirstCreationTimestamp

func GetFirstCreationTimestamp(network *config.NetworkInfos, websiteAddress string) (uint64, error)

func GetLastUpdateTimestamp

func GetLastUpdateTimestamp(network *config.NetworkInfos, websiteAddress string) (uint64, error)

func GetNumberOfChunks

func GetNumberOfChunks(client *node.Client, websiteAddress string) (int32, error)

GetNumberOfChunks fetches and returns the number of chunks for the website.

func GetOwner

func GetOwner(network *config.NetworkInfos, websiteAddress string) (string, error)

GetOwner retrieves the owner of the website.

func UploadChunk

func UploadChunk(
	websiteAddress string,
	walletConfig pkgConfig.WalletConfig,
	networkInfos *msConfig.NetworkInfos,
	scConfig *pkgConfig.SCConfig,
	chunk []byte,
	chunkIndex int,
) (operationID string, err error)

Types

type DeploymentResult

type DeploymentResult struct {
	Address     string
	OperationID string
}

func Deploy

func Deploy(walletNickname string, networkInfos *msConfig.NetworkInfos, scConfig *pkgConfig.SCConfig) (*DeploymentResult, error)

Jump to

Keyboard shortcuts

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