final class ChunkUploadSession (View source)

Carries immutable metadata for one active sequential upload assembled in temporary storage.

Its offsets and expiry describe the trusted server-side state rather than client-supplied progress.

Methods

__construct(string $uploadId, string $kind, string $profile, string $originalFilename, int $declaredSize, int $maxBytes, int $currentOffset, int $createdAt, int $expiresAt, array $context = [], int $chunkCount = 0, int $maxChunks = ChunkUploadConfig::DEFAULT_MAX_CHUNKS_PER_SESSION, string $publicationToken = '')

Creates a validated snapshot whose declared size and current offset cannot exceed the profile limit.

string

Returns the unguessable identifier used to locate and lock this temporary session.

string
string
kind()

Returns whether the session will complete through the generic file or image upload pipeline.

string
string

Returns the configured upload profile whose policy governs completion.

string
string

Returns the client filename retained for the existing extension validation boundary.

string
int

Returns the total byte count the client declared before any payload was accepted.

int
int

Returns the profile maximum captured when this session was started.

int
int

Returns the next byte offset required from a sequential append request.

int
int

Returns the server-counted number of chunks durably appended to this session.

int
int

Returns the chunk-count ceiling captured when the session reserved its quota.

int
string

Returns the private random token that makes completion retries target one stable filename.

string
int

Returns the UNIX timestamp at which the session was created.

int
int

Returns the fixed UNIX timestamp after which the session must not accept more data.

int
array

Returns application-owned opaque metadata persisted with this session.

array
bool
isExpired(int $now)

Reports whether the supplied UNIX timestamp is at or beyond this session's fixed expiry.

bool
withAppendedChunk(int $currentOffset)

Returns a new metadata snapshot after a fully persisted append advances the byte offset.

Details

__construct

__construct(string $uploadId, string $kind, string $profile, string $originalFilename, int $declaredSize, int $maxBytes, int $currentOffset, int $createdAt, int $expiresAt, array $context = [], int $chunkCount = 0, int $maxChunks = ChunkUploadConfig::DEFAULT_MAX_CHUNKS_PER_SESSION, string $publicationToken = '')

Creates a validated snapshot whose declared size and current offset cannot exceed the profile limit.

Parameters

string $uploadId
string $kind
string $profile
string $originalFilename
int $declaredSize
int $maxBytes
int $currentOffset
int $createdAt
int $expiresAt
array $context
int $chunkCount
int $maxChunks
string $publicationToken

uploadId

string uploadId()

Returns the unguessable identifier used to locate and lock this temporary session.

Return Value

string

kind

string kind()

Returns whether the session will complete through the generic file or image upload pipeline.

Return Value

string

profile

string profile()

Returns the configured upload profile whose policy governs completion.

Return Value

string

originalFilename

string originalFilename()

Returns the client filename retained for the existing extension validation boundary.

Return Value

string

declaredSize

int declaredSize()

Returns the total byte count the client declared before any payload was accepted.

Return Value

int

maxBytes

int maxBytes()

Returns the profile maximum captured when this session was started.

Return Value

int

currentOffset

int currentOffset()

Returns the next byte offset required from a sequential append request.

Return Value

int

chunkCount

int chunkCount()

Returns the server-counted number of chunks durably appended to this session.

Return Value

int

maxChunks

int maxChunks()

Returns the chunk-count ceiling captured when the session reserved its quota.

Return Value

int

publicationToken

string publicationToken()

Returns the private random token that makes completion retries target one stable filename.

Return Value

string

createdAt

int createdAt()

Returns the UNIX timestamp at which the session was created.

Return Value

int

expiresAt

int expiresAt()

Returns the fixed UNIX timestamp after which the session must not accept more data.

Return Value

int

context

array context()

Returns application-owned opaque metadata persisted with this session.

Return Value

array

isExpired

bool isExpired(int $now)

Reports whether the supplied UNIX timestamp is at or beyond this session's fixed expiry.

Parameters

int $now

Return Value

bool

withAppendedChunk

ChunkUploadSession withAppendedChunk(int $currentOffset)

Returns a new metadata snapshot after a fully persisted append advances the byte offset.

Parameters

int $currentOffset

Return Value

ChunkUploadSession