storage

package
v0.0.0-...-53546a6 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MIME_TYPE_JSON          = "application/json"
	CONTENT_ENCODING_BROTLI = "br"
)

Variables

View Source
var (
	S3SessionsPayloadBucketNameNew = os.Getenv("AWS_S3_BUCKET_NAME_NEW")
	S3SessionsStagingBucketName    = os.Getenv("AWS_S3_STAGING_BUCKET_NAME")
	S3SourceMapBucketNameNew       = os.Getenv("AWS_S3_SOURCE_MAP_BUCKET_NAME_NEW")
	S3ResourcesBucketName          = os.Getenv("AWS_S3_RESOURCES_BUCKET")
	S3GithubBucketName             = os.Getenv("AWS_S3_GITHUB_BUCKET_NAME")
	CloudfrontDomain               = os.Getenv("AWS_CLOUDFRONT_DOMAIN")
	CloudfrontPublicKeyID          = os.Getenv("AWS_CLOUDFRONT_PUBLIC_KEY_ID")
	CloudfrontPrivateKey           = os.Getenv("AWS_CLOUDFRONT_PRIVATE_KEY")
)

StoredPayloadTypes configures what payloads are uploaded with this config.

Functions

func UseNewSessionBucket

func UseNewSessionBucket(sessionId int) bool

Types

type Client

type Client interface {
	GetAssetURL(ctx context.Context, projectId string, hashVal string) (string, error)
	GetDirectDownloadURL(ctx context.Context, projectId int, sessionId int, payloadType PayloadType, chunkId *int) (*string, error)
	GetRawData(ctx context.Context, sessionId, projectId int, payloadType model.RawPayloadType) (map[int]string, error)
	GetSourceMapUploadUrl(ctx context.Context, key string) (string, error)
	GetSourcemapFiles(ctx context.Context, projectId int, version *string) ([]s3Types.Object, error)
	GetSourcemapVersions(ctx context.Context, projectId int) ([]string, error)
	PushCompressedFile(ctx context.Context, sessionId, projectId int, file *os.File, payloadType PayloadType, retentionPeriod privateModel.RetentionPeriod) (*int64, error)
	PushFiles(ctx context.Context, sessionId, projectId int, payloadManager *payload.PayloadManager, retentionPeriod privateModel.RetentionPeriod) (int64, error)
	PushRawEvents(ctx context.Context, sessionId, projectId int, payloadType model.RawPayloadType, events []redis.Z) error
	PushSourceMapFile(ctx context.Context, projectId int, version *string, fileName string, fileBytes []byte) (*int64, error)
	ReadResources(ctx context.Context, sessionId int, projectId int) ([]interface{}, error)
	ReadWebSocketEvents(ctx context.Context, sessionId int, projectId int) ([]interface{}, error)

	ReadSourceMapFileCached(ctx context.Context, projectId int, version *string, fileName string) ([]byte, error)
	ReadTimelineIndicatorEvents(ctx context.Context, sessionId int, projectId int) ([]*model.TimelineIndicatorEvent, error)
	UploadAsset(ctx context.Context, uuid string, contentType string, reader io.Reader, retentionPeriod privateModel.RetentionPeriod) error
	ReadGitHubFile(ctx context.Context, repoPath string, fileName string, version string) ([]byte, error)
	PushGitHubFile(ctx context.Context, repoPath string, fileName string, version string, fileBytes []byte) (*int64, error)
	// contains filtered or unexported methods
}

type FilesystemClient

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

func NewFSClient

func NewFSClient(_ context.Context, origin, fsRoot string) (*FilesystemClient, error)

func (*FilesystemClient) GetAssetURL

func (f *FilesystemClient) GetAssetURL(_ context.Context, projectId string, hashVal string) (string, error)

func (*FilesystemClient) GetDirectDownloadURL

func (f *FilesystemClient) GetDirectDownloadURL(_ context.Context, projectId int, sessionId int, payloadType PayloadType, chunkId *int) (*string, error)

func (*FilesystemClient) GetRawData

func (f *FilesystemClient) GetRawData(ctx context.Context, sessionId, projectId int, payloadType model.RawPayloadType) (map[int]string, error)

func (*FilesystemClient) GetSourceMapUploadUrl

func (f *FilesystemClient) GetSourceMapUploadUrl(_ context.Context, key string) (string, error)

func (*FilesystemClient) GetSourcemapFiles

func (f *FilesystemClient) GetSourcemapFiles(_ context.Context, projectId int, version *string) ([]s3Types.Object, error)

func (*FilesystemClient) GetSourcemapVersions

func (f *FilesystemClient) GetSourcemapVersions(_ context.Context, projectId int) ([]string, error)

func (*FilesystemClient) PushCompressedFile

func (f *FilesystemClient) PushCompressedFile(ctx context.Context, sessionId, projectId int, file *os.File, payloadType PayloadType, retentionPeriod privateModel.RetentionPeriod) (*int64, error)

func (*FilesystemClient) PushFiles

func (f *FilesystemClient) PushFiles(ctx context.Context, sessionId, projectId int, payloadManager *payload.PayloadManager, retentionPeriod privateModel.RetentionPeriod) (int64, error)

func (*FilesystemClient) PushGitHubFile

func (f *FilesystemClient) PushGitHubFile(ctx context.Context, repoPath string, fileName string, version string, fileBytes []byte) (*int64, error)

func (*FilesystemClient) PushRawEvents

func (f *FilesystemClient) PushRawEvents(ctx context.Context, sessionId, projectId int, payloadType model.RawPayloadType, events []redis.Z) error

func (*FilesystemClient) PushSourceMapFile

func (f *FilesystemClient) PushSourceMapFile(ctx context.Context, projectId int, version *string, fileName string, fileBytes []byte) (*int64, error)

func (*FilesystemClient) ReadGitHubFile

func (f *FilesystemClient) ReadGitHubFile(ctx context.Context, repoPath string, fileName string, version string) ([]byte, error)

func (*FilesystemClient) ReadResources

func (f *FilesystemClient) ReadResources(ctx context.Context, sessionId int, projectId int) ([]interface{}, error)

func (*FilesystemClient) ReadSourceMapFileCached

func (f *FilesystemClient) ReadSourceMapFileCached(ctx context.Context, projectId int, version *string, fileName string) ([]byte, error)

func (*FilesystemClient) ReadTimelineIndicatorEvents

func (f *FilesystemClient) ReadTimelineIndicatorEvents(ctx context.Context, sessionId int, projectId int) ([]*model.TimelineIndicatorEvent, error)

func (*FilesystemClient) ReadWebSocketEvents

func (f *FilesystemClient) ReadWebSocketEvents(ctx context.Context, sessionId int, projectId int) ([]interface{}, error)

func (*FilesystemClient) SetupHTTPSListener

func (f *FilesystemClient) SetupHTTPSListener(r chi.Router)

func (*FilesystemClient) UploadAsset

func (f *FilesystemClient) UploadAsset(ctx context.Context, uuid, _ string, reader io.Reader, retentionPeriod privateModel.RetentionPeriod) error

type PayloadType

type PayloadType string
const (
	NetworkResources           PayloadType = "network-resources"
	SessionContentsCompressed  PayloadType = "session-contents-compressed"
	NetworkResourcesCompressed PayloadType = "network-resources-compressed"
	TimelineIndicatorEvents    PayloadType = "timeline-indicator-events"
	WebSocketEventsCompressed  PayloadType = "web-socket-events-compressed"
)

func GetChunkedPayloadType

func GetChunkedPayloadType(offset int) PayloadType

type S3Client

type S3Client struct {
	S3ClientEast2   *s3.Client
	S3PresignClient *s3.PresignClient
	URLSigner       *sign.URLSigner
	Redis           *hredis.Client
}

func NewS3Client

func NewS3Client(ctx context.Context) (*S3Client, error)

func (*S3Client) GetAssetURL

func (s *S3Client) GetAssetURL(ctx context.Context, projectId string, hashVal string) (string, error)

func (*S3Client) GetDirectDownloadURL

func (s *S3Client) GetDirectDownloadURL(_ context.Context, projectId int, sessionId int, payloadType PayloadType, chunkId *int) (*string, error)

func (*S3Client) GetRawData

func (s *S3Client) GetRawData(ctx context.Context, sessionId, projectId int, payloadType model.RawPayloadType) (map[int]string, error)

func (*S3Client) GetSourceMapUploadUrl

func (s *S3Client) GetSourceMapUploadUrl(ctx context.Context, key string) (string, error)

func (*S3Client) GetSourcemapFiles

func (s *S3Client) GetSourcemapFiles(ctx context.Context, projectId int, version *string) ([]s3Types.Object, error)

func (*S3Client) GetSourcemapVersions

func (s *S3Client) GetSourcemapVersions(ctx context.Context, projectId int) ([]string, error)

func (*S3Client) PushCompressedFile

func (s *S3Client) PushCompressedFile(ctx context.Context, sessionId, projectId int, file *os.File, payloadType PayloadType, retentionPeriod privateModel.RetentionPeriod) (*int64, error)

PushCompressedFile pushes a compressed file to S3, adding the relevant metadata

func (*S3Client) PushFileToS3

func (s *S3Client) PushFileToS3(ctx context.Context, sessionId, projectId int, file *os.File, payloadType PayloadType) (*int64, error)

func (*S3Client) PushFiles

func (s *S3Client) PushFiles(ctx context.Context, sessionId, projectId int, payloadManager *payload.PayloadManager, retentionPeriod privateModel.RetentionPeriod) (int64, error)

func (*S3Client) PushGitHubFile

func (s *S3Client) PushGitHubFile(ctx context.Context, repoPath string, fileName string, version string, fileBytes []byte) (*int64, error)

func (*S3Client) PushGitHubFileReaderToS3

func (s *S3Client) PushGitHubFileReaderToS3(ctx context.Context, repoPath string, fileName string, version string, file io.Reader) (*int64, error)

func (*S3Client) PushRawEvents

func (s *S3Client) PushRawEvents(ctx context.Context, sessionId, projectId int, payloadType model.RawPayloadType, events []redis.Z) error

func (*S3Client) PushSourceMapFile

func (s *S3Client) PushSourceMapFile(ctx context.Context, projectId int, version *string, fileName string, fileBytes []byte) (*int64, error)

func (*S3Client) PushSourceMapFileReaderToS3

func (s *S3Client) PushSourceMapFileReaderToS3(ctx context.Context, projectId int, version *string, fileName string, file io.Reader) (*int64, error)

func (*S3Client) ReadGitHubFile

func (s *S3Client) ReadGitHubFile(ctx context.Context, repoPath string, fileName string, version string) ([]byte, error)

func (*S3Client) ReadResources

func (s *S3Client) ReadResources(ctx context.Context, sessionId int, projectId int) ([]interface{}, error)

func (*S3Client) ReadSourceMapFileCached

func (s *S3Client) ReadSourceMapFileCached(ctx context.Context, projectId int, version *string, fileName string) ([]byte, error)

func (*S3Client) ReadTimelineIndicatorEvents

func (s *S3Client) ReadTimelineIndicatorEvents(ctx context.Context, sessionId int, projectId int) ([]*model.TimelineIndicatorEvent, error)

func (*S3Client) ReadUncompressedResourcesFromS3

func (s *S3Client) ReadUncompressedResourcesFromS3(ctx context.Context, sessionId int, projectId int) ([]interface{}, error)

ReadUncompressedResourcesFromS3 is deprecated. Serves legacy uncompressed network data from S3.

func (*S3Client) ReadWebSocketEvents

func (s *S3Client) ReadWebSocketEvents(ctx context.Context, sessionId int, projectId int) ([]interface{}, error)

func (*S3Client) UploadAsset

func (s *S3Client) UploadAsset(ctx context.Context, uuid string, contentType string, reader io.Reader, retentionPeriod privateModel.RetentionPeriod) error

Jump to

Keyboard shortcuts

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