Http40DownloadState.sleela
lib/http-4.0/Http40DownloadState.sleela · 86 line(s) · sleela
#sleela 2.5
material;
< Shared resumable DOWNLOAD contract; 50 MiB is a mode threshold, not a cap. >
class Http40DownloadState {
< ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
<< Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
or catalog can read and (where appropriate) override this record.
Values are faithful to the subject's real origin where publicly known. >>
String metaVersion = "1.0.0";
int metaId = 11492;
String metaAuthor = "Max Rupplin vs. Dr. Mrs. Elisabeth Harkins";
String metaDate = "2026-10-21";
String metaCopyright = "SLeeLa project";
String metaTrademark = "none";
String metaCorporation = "none";
< metaOrigin: National | <nation> | International | Galactic >
String metaOrigin = "International";
String metaBirthDate = "2026-10-21";
< metaScienceRating: maturity/robustness on a 1..10 scale >
int metaScienceRating = 9;
< metaNationalSchedule: a real, citable instrument or "none" >
String metaNationalSchedule = "none";
String getMetaVersion() { return metaVersion; }
void setMetaVersion(String v) { metaVersion = v; }
int getMetaId() { return metaId; }
void setMetaId(int v) { metaId = v; }
String getAuthor() { return metaAuthor; }
void setAuthor(String v) { metaAuthor = v; }
String getDate() { return metaDate; }
void setDate(String v) { metaDate = v; }
String getCopyright() { return metaCopyright; }
void setCopyright(String v) { metaCopyright = v; }
String getTrademark() { return metaTrademark; }
void setTrademark(String v) { metaTrademark = v; }
String getCorporation() { return metaCorporation; }
void setCorporation(String v) { metaCorporation = v; }
String getOrigin() { return metaOrigin; }
void setOrigin(String v) { metaOrigin = v; }
String getBirthDate() { return metaBirthDate; }
void setBirthDate(String v) { metaBirthDate = v; }
int getScienceRating() { return metaScienceRating; }
void setScienceRating(int v) { metaScienceRating = v; }
String getNationalSchedule() { return metaNationalSchedule; }
void setNationalSchedule(String v) { metaNationalSchedule = v; }
long LARGE_FILE_THRESHOLD = 52428800;
String sessionId = "";
String dateTime = "";
String fileId = "";
String fileName = "";
String contentDigest = "";
String expectedFileVersion = "";
String authorizedPrincipalId = "";
String authenticatedResumeToken = "";
boolean allChunksVerified = false;
boolean finalDigestVerified = false;
long index = 0;
long offset = 0;
long totalSize = 0;
long chunkSize = 0;
void configure(String session, String timestamp, String id, String name,
long segmentIndex, long byteOffset, long completeSize, long chunk) {
sessionId = session; dateTime = timestamp; fileId = id; fileName = name;
index = segmentIndex; offset = byteOffset; totalSize = completeSize; chunkSize = chunk;
}
boolean requiresDownloadMode(long size) { return size > LARGE_FILE_THRESHOLD; }
boolean isValid() {
return sessionId != "" && fileId != "" && fileName != "" &&
index >= 0 && offset >= 0 && totalSize >= 0 && offset <= totalSize &&
chunkSize >= 0 && (chunkSize == 0 || chunkSize <= totalSize - offset);
}
long remainingBytes() { return totalSize - offset; }
boolean isComplete() { return isValid() && offset == totalSize; }
boolean hasResumeAuthorizationMetadata() {
return isValid() && expectedFileVersion != "" &&
authorizedPrincipalId != "" && authenticatedResumeToken != "" &&
contentDigest != "";
}
< These flags are policy inputs, not cryptographic proof. Native code must >
< verify token, principal, chunk hashes, and final digest before setting them. >
boolean mayCommit() {
return hasResumeAuthorizationMetadata() && isComplete() &&
allChunksVerified && finalDigestVerified;
}
}