handlers

package
v0.0.0-...-d0d5b17 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const ChunkSize = 1024 * 1024 * 64
View Source
const MaxRetries = 5

MaxRetries maximum number of retries

Variables

This section is empty.

Functions

func GetIndexdRecordRev

func GetIndexdRecordRev(uuid, indexURL string) (string, error)

GetIndexdRecordRev gets record rev

func GetObjectSize

func GetObjectSize(client *AwsClient, bucket string, key string) (*int64, error)

GetObjectSize returns object size in bytes

func GetS3ObjectOutput

func GetS3ObjectOutput(client *AwsClient, bucket string, key string) (*s3.GetObjectOutput, error)

GetS3ObjectOutput gets object output from s3

func IndexS3Object

func IndexS3Object(s3objectURL string)

IndexS3Object indexes s3 object The fuction does several things. It downloads the object from S3, computes size and hashes, and updates Indexd and potentially Metadata Service

func UpdateIndexdRecord

func UpdateIndexdRecord(uuid, rev string, indexdInfo *IndexdInfo, body []byte) (*http.Response, error)

UpdateIndexdRecord updates the record with size, urls and hashes encoded in body

func UpdateMetadataObject

func UpdateMetadataObject(uuid string, mdsInfo *MetadataServiceInfo, body []byte) (*http.Response, error)

Updates Metadata Service object specified by uuid with provided body

Types

type AwsClient

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

AWS sesssion wrapper

func CreateNewAwsClient

func CreateNewAwsClient() (*AwsClient, error)

CreateNewSession creates an aws s3 session

type ConfigInfo

type ConfigInfo struct {
	Indexd          IndexdInfo          `json:"indexd"`
	MetadataService MetadataServiceInfo `json:"metadataService"`
}

type HashCollection

type HashCollection struct {
	Crc32c hash.Hash
	Md5    hash.Hash
	Sha1   hash.Hash
	Sha256 hash.Hash
	Sha512 hash.Hash
}

HashCollection contains hashes

func CreateNewHashCollection

func CreateNewHashCollection() *HashCollection

CreateNewHashCollection creates a new HashCollection

func UpdateBasicHashes

func UpdateBasicHashes(hashCollection *HashCollection, rd []byte) (*HashCollection, error)

UpdateBasicHashes updates a hashes collection

func (*HashCollection) Reset

func (h *HashCollection) Reset()

type HashInfo

type HashInfo struct {
	Crc32c string
	Md5    string
	Sha1   string
	Sha256 string
	Sha512 string
}

func CalculateBasicHashes

func CalculateBasicHashes(client *AwsClient, bucket string, key string) (*HashInfo, int64, error)

CalculateBasicHashes generates hashes of aws bucket object

type IndexdInfo

type IndexdInfo struct {
	URL      string `json:"url"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type MetadataServiceInfo

type MetadataServiceInfo struct {
	URL      string `json:"url"`
	Username string `json:"username"`
	Password string `json:"password"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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