v2archive

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const ManifestVersion = ManifestVersionV2

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchiveReader

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

func NewReader

func NewReader(ctx rcontext.RequestContext) *ArchiveReader

func (*ArchiveReader) GetEntityId

func (r *ArchiveReader) GetEntityId() string

func (*ArchiveReader) GetNotUploadedMxcUris

func (r *ArchiveReader) GetNotUploadedMxcUris() []string

func (*ArchiveReader) HasManifest

func (r *ArchiveReader) HasManifest() bool

func (*ArchiveReader) ProcessFile

func (r *ArchiveReader) ProcessFile(file io.ReadCloser, opts ProcessOpts) error

func (*ArchiveReader) ProcessS3Files

func (r *ArchiveReader) ProcessS3Files(opts ProcessOpts) error

func (*ArchiveReader) TryGetManifestFrom

func (r *ArchiveReader) TryGetManifestFrom(file io.ReadCloser) (bool, error)

type ArchiveWriter

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

func NewWriter

func NewWriter(ctx rcontext.RequestContext, exportId string, entity string, partSize int64, writeFn PartPersister) (*ArchiveWriter, error)

func (*ArchiveWriter) AppendMedia

func (w *ArchiveWriter) AppendMedia(file io.ReadCloser, info MediaInfo) (string, error)

AppendMedia / returns (sha256hash, error)

func (*ArchiveWriter) Finish

func (w *ArchiveWriter) Finish() error

type Manifest

type Manifest struct {
	Version   ManifestVersionVal         `json:"version"`
	EntityId  string                     `json:"entity_id"`
	CreatedTs int64                      `json:"created_ts"`
	Media     map[string]*ManifestRecord `json:"media"`

	// Deprecated: for v1 manifests, now called EntityId
	UserId string `json:"user_id,omitempty"`
}

type ManifestRecord

type ManifestRecord struct {
	FileName     string `json:"name"`
	ArchivedName string `json:"file_name"`
	SizeBytes    int64  `json:"size_bytes"`
	ContentType  string `json:"content_type"`
	S3Url        string `json:"s3_url"`
	Sha256       string `json:"sha256"`
	Origin       string `json:"origin"`
	MediaId      string `json:"media_id"`
	CreatedTs    int64  `json:"created_ts"`
	Uploader     string `json:"uploader"`
}

type ManifestVersionVal

type ManifestVersionVal int
const (
	ManifestVersionV1 ManifestVersionVal = 1
	ManifestVersionV2 ManifestVersionVal = 2
)

type MediaInfo

type MediaInfo struct {
	Origin      string
	MediaId     string
	FileName    string
	ContentType string
	CreationTs  int64
	S3Url       string
	UserId      string
}

type PartPersister

type PartPersister func(part int, fileName string, data io.ReadCloser) error

type ProcessOpts

type ProcessOpts struct {
	LockedEntityId    string
	CheckUploadedOnly bool
	ProcessFunction   func(record *ManifestRecord, f io.ReadCloser) error
}

Jump to

Keyboard shortcuts

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