aws

package
v1.13.3 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: Apache-2.0, MIT Imports: 64 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REQUEST_PROTOCOL     = "http://"
	PARAM_ACTION         = "Action"
	PARAM_USER           = "User"
	ACTION_NAME          = "connect"
	SERVICE_NAME         = "elasticache"
	PARAM_EXPIRES        = "X-Amz-Expires"
	TOKEN_EXPIRY_SECONDS = 899

	EMPTY_BODY_SHA256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" // the hex encoded SHA-256 of an empty string
)

Variables

View Source
var ErrDynamoRecordNotFound = errors.New("no record found in dynamo table")

ErrDynamoRecordNotFound is used when there is no record in a dynamo table (given that GetItem does not actually error)

View Source
var ErrNoPrivateKey = errors.New("no value for private key")

ErrNoPrivateKey means that the value returned from Secrets was empty

Functions

func Construct

func Construct(cfg Config) (types.Service, error)

Construct constructs types.Service from AWS deps for Lamda functions

func NewBlockIndexTableMapper

func NewBlockIndexTableMapper(id principal.Signer, blockIndexStore BlockIndexStore, migratedShardChecker MigratedShardChecker, bucketURL string, claimExpiration time.Duration, bucketPrefixes []string) (blockIndexTableMapper, error)

NewBlockIndexTableMapper creates a new ContentToClaimsMapper that synthethizes location claims from data in the blockIndexStore - a giant index of historical data, mapping multihashes to bucket keys/URLs and their byte offsets.

The data referenced by bucket keys in the blockIndexStore has been consolidated into a single bucket. So this instance does the work of mapping old bucket keys to URLs, where the base URL is the passed bucketURL param.

Using the data in the blockIndexStore, the service will materialize content claims using the id param as the signing key. Claims will be set to expire in the amount of time given by the claimExpiration parameter.

Types

type AllocationsStore

type AllocationsStore interface {
	Has(ctx context.Context, digest multihash.Multihash) (bool, error)
}

type BlockIndexRecord

type BlockIndexRecord struct {
	CarPath string
	Offset  uint64
	Length  uint64
}

type BlockIndexStore

type BlockIndexStore interface {
	Query(ctx context.Context, digest multihash.Multihash) ([]BlockIndexRecord, error)
}

type BucketFallbackMapper

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

func NewBucketFallbackMapper

func NewBucketFallbackMapper(id principal.Signer, httpClient *http.Client, bucketURL *url.URL, allocationsStore AllocationsStore, getOpts func() []delegation.Option) BucketFallbackMapper

func (BucketFallbackMapper) GetClaims

func (cfm BucketFallbackMapper) GetClaims(ctx context.Context, contentHash multihash.Multihash) ([]cid.Cid, error)

type Config

type Config struct {
	construct.ServiceConfig
	aws.Config
	LegacyConfig
	SupportLegacyServices             bool
	ProvidersCacheExpirationSeconds   int64
	NoProvidersCacheExpirationSeconds int64
	ClaimsCacheExpirationSeconds      int64
	IndexesCacheExpirationSeconds     int64
	SQSCachingQueueID                 string
	CachingBucket                     string
	SQSPublishingQueueID              string
	PublishingBucket                  string
	SQSAdvertisementPublishingQueueID string
	ChunkLinksTableName               string
	MetadataTableName                 string
	IPNIStoreBucket                   string
	IPNIStorePrefix                   string
	IPNIAnnounceURLs                  []url.URL
	NotifierHeadBucket                string
	NotifierTopicArn                  string
	ClaimStoreBucket                  string
	ClaimStorePrefix                  string
	BaseTraceSampleRatio              float64
	SentryDSN                         string
	SentryEnvironment                 string
	TelemetryEnabled                  bool
	PrincipalMapping                  map[string]string
	IPNIFormatPeerID                  string
	IPNIFormatEndpoint                string
	principal.Signer
}

Config describes all the values required to setup AWS from the environment

func FromEnv

func FromEnv(ctx context.Context) Config

FromEnv constructs the AWS Configuration from the environment

type DynamoAllocationsTable

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

func NewDynamoAllocationsTable

func NewDynamoAllocationsTable(client dynamodb.QueryAPIClient, tableName string) *DynamoAllocationsTable

func (*DynamoAllocationsTable) Has

type DynamoContentToClaimsMapper

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

DynamoContentToClaimsMapper uses a DynamoDB table to map content hashes to the corresponding claims

func NewDynamoContentToClaimsMapper

func NewDynamoContentToClaimsMapper(queryClient dynamodb.QueryAPIClient, tableName string) DynamoContentToClaimsMapper

func (DynamoContentToClaimsMapper) GetClaims

func (dm DynamoContentToClaimsMapper) GetClaims(ctx context.Context, contentHash multihash.Multihash) ([]cid.Cid, error)

GetClaim returns claim CIDs for a given content hash. Implements ContentToClaimMapper

type DynamoMigratedShardChecker

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

func NewDynamoMigratedShardChecker

func NewDynamoMigratedShardChecker(storeTableName string, storeTableClient dynamodb.QueryAPIClient, blobRegistryTableName string, blobRegistryTableClient dynamodb.QueryAPIClient, allocationsStore AllocationsStore) *DynamoMigratedShardChecker

func (*DynamoMigratedShardChecker) ShardMigrated

func (d *DynamoMigratedShardChecker) ShardMigrated(ctx context.Context, shard ipld.Link) (bool, error)

type DynamoProviderBlockIndexTable

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

func NewDynamoProviderBlockIndexTable

func NewDynamoProviderBlockIndexTable(client dynamodb.QueryAPIClient, tableName string) *DynamoProviderBlockIndexTable

func (*DynamoProviderBlockIndexTable) Query

type DynamoProviderContextTable

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

DynamoProviderContextTable implements the store.ProviderContextTable interface on dynamodb

func NewDynamoProviderContextTable

func NewDynamoProviderContextTable(cfg aws.Config, tableName string) *DynamoProviderContextTable

NewDynamoProviderContextTable returns a ProviderContextTable connected to a AWS DynamoDB table

func (*DynamoProviderContextTable) Delete

func (d *DynamoProviderContextTable) Delete(ctx context.Context, p peer.ID, contextID []byte) error

Delete implements store.ProviderContextTable.

func (*DynamoProviderContextTable) Get

func (d *DynamoProviderContextTable) Get(ctx context.Context, p peer.ID, contextID []byte) ([]byte, error)

Get implements store.ProviderContextTable.

func (*DynamoProviderContextTable) Put

func (d *DynamoProviderContextTable) Put(ctx context.Context, p peer.ID, contextID []byte, data []byte) error

Put implements store.ProviderContextTable.

type IAMAuthTokenRequest

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

type LegacyConfig added in v1.12.1

type LegacyConfig struct {
	LegacyClaimsTableName          string
	LegacyClaimsTableRegion        string
	LegacyClaimsBucket             string
	LegacyBlockIndexTableName      string
	LegacyBlockIndexTableRegion    string
	LegacyStoreTableName           string
	LegacyStoreTableRegion         string
	LegacyBlobRegistryTableName    string
	LegacyBlobRegistryTableRegion  string
	LegacyAllocationsTableName     string
	LegacyAllocationsTableRegion   string
	LegacyDotStorageBucketPrefixes []string // legacy .storage buckets
	LegacyDataBucketURL            string
}

type MigratedShardChecker

type MigratedShardChecker interface {
	ShardMigrated(ctx context.Context, shard ipld.Link) (bool, error)
}

type S3Store

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

S3Store implements the store.Store interface on S3

func NewS3Store

func NewS3Store(cfg aws.Config, bucket string, keyPrefix string) *S3Store

func NewS3StoreWithClient

func NewS3StoreWithClient(client *s3.Client, bucket string, keyPrefix string) *S3Store

func (*S3Store) Get

func (s *S3Store) Get(ctx context.Context, key string) (io.ReadCloser, error)

Get implements store.Store.

func (*S3Store) Put

func (s *S3Store) Put(ctx context.Context, key string, len uint64, data io.Reader) error

Put implements store.Store.

func (*S3Store) Replace

func (s *S3Store) Replace(ctx context.Context, key string, old io.Reader, length uint64, new io.Reader) error

type SNSRemoteSyncMessage

type SNSRemoteSyncMessage struct {
	Head string `json:"Head,omitempty"`
	Prev string `json:"Prev,omitempty"`
}

type SNSRemoteSyncNotifier

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

func NewSNSRemoteSyncNotifier

func NewSNSRemoteSyncNotifier(config aws.Config, topicArn string) *SNSRemoteSyncNotifier

func (*SNSRemoteSyncNotifier) NotifyRemoteSync

func (s *SNSRemoteSyncNotifier) NotifyRemoteSync(ctx context.Context, head, prev ipld.Link)

type SQSCachingDecoder

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

SQSCachingDecoder provides interfaces for working with caching jobs received over SQS

func NewSQSCachingDecoder

func NewSQSCachingDecoder(cfg aws.Config, bucket string) *SQSCachingDecoder

NewSQSCachingDecoder returns a new decoder for the given AWS config

func (*SQSCachingDecoder) DecodeMessage

func (s *SQSCachingDecoder) DecodeMessage(ctx context.Context, receiptHandle string, messageBody string) (queuepoller.WithID[providercacher.ProviderCachingJob], error)

DecodeMessage decodes a provider caching job from the SQS message body, reading the stored index from S3

type SQSCachingQueue

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

SQSCachingQueue implements the providercacher.CachingQueue interface using SQS

func NewSQSCachingQueue

func NewSQSCachingQueue(cfg aws.Config, queueID string, bucket string) *SQSCachingQueue

NewSQSCachingQueue returns a new SQSCachingQueue for the given aws config

func (*SQSCachingQueue) Delete

func (s *SQSCachingQueue) Delete(ctx context.Context, jobID string) error

Delete deletes a job message from the SQS queue.

func (*SQSCachingQueue) Queue

Queue implements blobindexlookup.CachingQueue.

func (*SQSCachingQueue) Read

Read reads a batch of jobs from the SQS queue. Returns an empty slice if no jobs are available. The caller must process jobs and delete them from the queue when done.

func (*SQSCachingQueue) Release

func (s *SQSCachingQueue) Release(ctx context.Context, jobID string) error

Release makes a job available for processing again by making it visible in the queue

Jump to

Keyboard shortcuts

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