Documentation
¶
Index ¶
- Constants
- func FindUploaderInManifest(object string, oo io.Reader) string
- func GetIndexdRecordRev(uuid, indexURL string) (string, error)
- func IndexS3Object(s3objectURL string)
- func IndexS3ObjectEmbedded(s3objectURL string, indexdInfo *IndexdInfo, awsConfig *aws.Config)
- func RunIndexS3Object(s3objectURL string, indexdInfo *IndexdInfo, client *AwsClient)
- func SearchRecordByURL(indexdInfo *IndexdInfo, url string) (searchResponse, error)
- func UpdateIndexdRecord(uuid, rev string, indexdInfo *IndexdInfo, body []byte) (*http.Response, error)
- type AwsClient
- func (client *AwsClient) CalculateBasicHashes(bucket string, key string) (*HashInfo, int64, error)
- func (client *AwsClient) GetObjectSize(bucket string, key string) (*int64, error)
- func (client *AwsClient) GetS3BucketOwner(bucket string) (string, error)
- func (client *AwsClient) GetS3ObjectOutput(bucket string, key string) (*s3.GetObjectOutput, error)
- type HashCollection
- type HashInfo
- type IndexdInfo
- type IndexdRecord
Constants ¶
View Source
const ChunkSize = 1024 * 1024 * 64
View Source
const MaxRetries = 10
MaxRetries maximum number of retries
Variables ¶
This section is empty.
Functions ¶
func GetIndexdRecordRev ¶
GetIndexdRecordRev gets record rev
func IndexS3Object ¶
func IndexS3Object(s3objectURL string)
IndexS3Object indexes s3 object The fuction does several things. It first downloads the object from S3, computes size and hashes, and update indexd
func IndexS3ObjectEmbedded ¶
func IndexS3ObjectEmbedded(s3objectURL string, indexdInfo *IndexdInfo, awsConfig *aws.Config)
func RunIndexS3Object ¶
func RunIndexS3Object(s3objectURL string, indexdInfo *IndexdInfo, client *AwsClient)
func SearchRecordByURL ¶
func SearchRecordByURL(indexdInfo *IndexdInfo, url string) (searchResponse, error)
func UpdateIndexdRecord ¶
func UpdateIndexdRecord(uuid, rev string, indexdInfo *IndexdInfo, body []byte) (*http.Response, error)
UpdateIndexdRecord updates the record with size, urls and hashes endcoded in body
Types ¶
type AwsClient ¶
type AwsClient struct {
// contains filtered or unexported fields
}
AWS sesssion wrapper
func CreateNewAwsClient ¶
CreateNewSession creates an aws s3 session
func (*AwsClient) CalculateBasicHashes ¶
CalculateBasicHashes generates hashes of aws bucket object
func (*AwsClient) GetObjectSize ¶
GetObjectSize returns object size in bytes
func (*AwsClient) GetS3BucketOwner ¶
func (*AwsClient) GetS3ObjectOutput ¶
GetS3ObjectOutput gets object output from s3
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 IndexdInfo ¶
type IndexdInfo struct { URL string `json:"url"` Username string `json:"username"` Password string `json:"password"` ExtramuralBucket bool `json:"extramural_bucket"` ExtramuralUploader *string `json:"extramural_uploader"` ExtramuralUploaderS3Owner bool `json:"extramural_uploader_s3owner"` ExtramuralUploaderManifest *string `json:"extramural_uploader_manifest"` ExtramuralInitialMode bool `json:"extramural_initial_mode"` // If true, skips hash updates if record is already found in index ExtramuralFastMode bool `json:"extramural_fast_mode"` // If true, always creates a new record for the object }
type IndexdRecord ¶
type IndexdRecord struct { DID string `json:"did"` BaseID string `json:"baseid"` Rev string `json:"rev"` }
func CreateBlankIndexdRecord ¶
func CreateBlankIndexdRecord(indexdInfo *IndexdInfo, body []byte) (*IndexdRecord, error)
Click to show internal directories.
Click to hide internal directories.