Release ObjectStore 0.1.1
This commit is contained in:
1 parent
bd6bb52dc7
commit
240c278621
20 files changed
+14034
-5
No files matched your search
@@ -0,0 +1,334 @@
|
||||
package cloud.lunarsky.store;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
final class AdminBrowser {
|
||||
private static final int PAGE_SIZE = 50;
|
||||
private static final DateTimeFormatter TIME = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm 'UTC'")
|
||||
.withZone(ZoneOffset.UTC);
|
||||
|
||||
private AdminBrowser() { }
|
||||
|
||||
static String index(ObjectStorage store, String rawQuery, String csrf) throws IOException {
|
||||
Map<String, String> query = query(rawQuery, Set.of("filter", "after"));
|
||||
String filter = query.getOrDefault("filter", "").trim();
|
||||
String after = query.get("after");
|
||||
if (filter.length() > 256 || after != null && after.length() > 255)
|
||||
throw invalidQuery();
|
||||
List<ObjectStorage.Bucket> matches = store.buckets().stream()
|
||||
.filter(bucket -> bucket.name().toLowerCase(Locale.ROOT).contains(filter.toLowerCase(Locale.ROOT)))
|
||||
.sorted(Comparator.comparing(ObjectStorage.Bucket::name)).toList();
|
||||
List<ObjectStorage.Bucket> page = matches.stream()
|
||||
.filter(bucket -> after == null || bucket.name().compareTo(after) > 0)
|
||||
.limit(PAGE_SIZE + 1).toList();
|
||||
boolean next = page.size() > PAGE_SIZE;
|
||||
if (next) page = page.subList(0, PAGE_SIZE);
|
||||
|
||||
StringBuilder html = new StringBuilder(AdminConsole.consoleHeader(csrf));
|
||||
html.append("<nav class=crumbs aria-label=Breadcrumb><a href='")
|
||||
.append(AdminConsole.PATH).append("/overview'>Overview</a><span>/</span><span>Buckets</span></nav>")
|
||||
.append("<div class=intro><div><h2>Buckets</h2><p>")
|
||||
.append(matches.size()).append(" matching buckets · read-only</p></div></div>")
|
||||
.append("<div class=toolbar><form method=get action='").append(AdminConsole.PATH)
|
||||
.append("/buckets'><div class=field><label for=bucket-filter>Find a bucket</label>")
|
||||
.append("<input id=bucket-filter name=filter value='").append(AdminConsole.escape(filter))
|
||||
.append("' placeholder='Bucket name'></div><button type=submit>Search</button></form>")
|
||||
.append("<a class=button-link href='").append(AdminConsole.PATH)
|
||||
.append("/overview'>Overview</a></div>");
|
||||
if (page.isEmpty()) {
|
||||
html.append("<div class='table-wrap empty'>No buckets match this search.</div>");
|
||||
} else {
|
||||
html.append("<div class=table-wrap><table><thead><tr><th>Bucket</th><th>Versioning</th>")
|
||||
.append("<th>Ownership</th><th>Created</th></tr></thead><tbody>");
|
||||
for (ObjectStorage.Bucket bucket : page) {
|
||||
html.append("<tr><td class=name-cell><a href='")
|
||||
.append(bucketUrl(bucket.name(), "", null)).append("'>")
|
||||
.append(AdminConsole.escape(bucket.name())).append("</a></td><td>")
|
||||
.append(versioning(bucket.versioning())).append("</td><td>")
|
||||
.append(ownership(bucket.ownership())).append("</td><td>")
|
||||
.append(time(bucket.created())).append("</td></tr>");
|
||||
}
|
||||
html.append("</tbody></table></div>");
|
||||
}
|
||||
if (after != null || next) {
|
||||
html.append("<nav class=pagination aria-label='Bucket pages'><a class=button-link href='")
|
||||
.append(indexUrl(filter, null)).append("'>First page</a>");
|
||||
if (next) html.append("<a class=button-link href='")
|
||||
.append(indexUrl(filter, page.getLast().name())).append("'>Next page →</a>");
|
||||
html.append("</nav>");
|
||||
}
|
||||
return html.toString();
|
||||
}
|
||||
|
||||
static String bucket(ObjectStorage store, String rawQuery, String csrf) throws IOException {
|
||||
Map<String, String> query = query(rawQuery, Set.of("name", "prefix", "after"));
|
||||
String name = required(query, "name", 255);
|
||||
String prefix = query.getOrDefault("prefix", "");
|
||||
String after = query.get("after");
|
||||
if (prefix.length() > 1024 || after != null && after.length() > 1024)
|
||||
throw invalidQuery();
|
||||
ObjectStorage.Bucket bucket = store.bucket(name);
|
||||
ObjectStorage.ListPage page = store.list(name, prefix, "/", PAGE_SIZE, after);
|
||||
long visibleBytes = page.objects().stream().mapToLong(entry -> entry.metadata().length()).sum();
|
||||
|
||||
StringBuilder html = new StringBuilder(AdminConsole.consoleHeader(csrf));
|
||||
html.append(breadcrumbs(name, prefix));
|
||||
html.append("<div class=intro><div><h2>").append(AdminConsole.escape(name))
|
||||
.append("</h2><p>Browse prefixes and inspect object metadata.</p></div>")
|
||||
.append("<biscuit-badgeview theme=dark variant=accent>Read-only</biscuit-badgeview></div>")
|
||||
.append("<div class=grid><biscuit-cardview><small>Entries on this page</small><strong>")
|
||||
.append(page.keyCount()).append("</strong></biscuit-cardview>")
|
||||
.append("<biscuit-cardview><small>Object bytes on this page</small><strong>")
|
||||
.append(AdminConsole.formatBytes(visibleBytes)).append("</strong></biscuit-cardview>")
|
||||
.append("<biscuit-cardview><small>Versioning</small><strong>")
|
||||
.append(versioning(bucket.versioning())).append("</strong></biscuit-cardview></div>")
|
||||
.append("<section class=buckets id=objects><h2>Objects</h2>")
|
||||
.append("<p>Showing up to ").append(PAGE_SIZE)
|
||||
.append(" entries in this prefix. Counts and chart data describe this page only.</p>")
|
||||
.append("<div class=toolbar><form method=get action='").append(AdminConsole.PATH)
|
||||
.append("/bucket'><input type=hidden name=name value='").append(AdminConsole.escape(name))
|
||||
.append("'><div class=field><label for=prefix>Prefix</label>")
|
||||
.append("<input id=prefix name=prefix value='").append(AdminConsole.escape(prefix))
|
||||
.append("' placeholder='e.g. images/2026/'></div><button type=submit>Browse</button></form>")
|
||||
.append("<a class=button-link href='").append(AdminConsole.PATH)
|
||||
.append("/buckets'>All buckets</a></div>");
|
||||
if (page.keyCount() == 0) {
|
||||
html.append("<div class='table-wrap empty'>Nothing in this prefix.</div>");
|
||||
if (!prefix.isEmpty()) html.append("<nav class=pagination><a class=button-link href='")
|
||||
.append(bucketUrl(name, parentPrefix(prefix), null)).append("'>← Parent folder</a></nav>");
|
||||
} else {
|
||||
html.append("<div class=table-wrap><table><thead><tr><th>Name</th><th>Kind</th>")
|
||||
.append("<th>Size</th><th>Modified</th></tr></thead><tbody>");
|
||||
if (!prefix.isEmpty()) {
|
||||
html.append("<tr><td class=name-cell><a href='")
|
||||
.append(bucketUrl(name, parentPrefix(prefix), null))
|
||||
.append("'>../</a></td><td class=kind>Parent</td><td>—</td><td>—</td></tr>");
|
||||
}
|
||||
for (String folder : page.prefixes()) {
|
||||
html.append("<tr><td class=name-cell><a href='")
|
||||
.append(bucketUrl(name, folder, null)).append("'>▸ ")
|
||||
.append(AdminConsole.escape(folder.substring(prefix.length())))
|
||||
.append("</a></td><td class=kind>Folder</td><td>—</td><td>—</td></tr>");
|
||||
}
|
||||
for (ObjectStorage.ListedObject object : page.objects()) {
|
||||
ObjectStorage.Metadata meta = object.metadata();
|
||||
String label = object.key().substring(prefix.length());
|
||||
if (label.isEmpty()) label = "(folder marker)";
|
||||
html.append("<tr><td class=name-cell><a href='")
|
||||
.append(objectUrl(name, object.key())).append("'>")
|
||||
.append(AdminConsole.escape(label)).append("</a></td><td class=kind>Object</td><td>")
|
||||
.append(AdminConsole.formatBytes(meta.length())).append("</td><td>")
|
||||
.append(time(meta.modified())).append("</td></tr>");
|
||||
}
|
||||
html.append("</tbody></table></div>");
|
||||
}
|
||||
if (after != null || page.truncated()) {
|
||||
html.append("<nav class=pagination aria-label='Object pages'><a class=button-link href='")
|
||||
.append(bucketUrl(name, prefix, null)).append("'>First page</a>");
|
||||
if (page.truncated()) html.append("<a class=button-link href='")
|
||||
.append(bucketUrl(name, prefix, page.nextKey())).append("'>Next page →</a>");
|
||||
html.append("</nav>");
|
||||
}
|
||||
html.append("</section>");
|
||||
if (!page.objects().isEmpty()) {
|
||||
html.append("<section class=insight><biscuit-chartview type=bar theme=dark ")
|
||||
.append("name='Largest objects on this page' height=300>")
|
||||
.append("<biscuit-series type=bar x=label y=bytes name='Size in bytes'>");
|
||||
page.objects().stream().sorted(Comparator.comparingLong((ObjectStorage.ListedObject object) ->
|
||||
object.metadata().length()).reversed()).limit(10).forEach(object -> {
|
||||
String label = object.key().substring(prefix.length());
|
||||
if (label.length() > 24) label = label.substring(0, 23) + "…";
|
||||
html.append("<biscuit-point x='").append(AdminConsole.escape(label))
|
||||
.append("' y='").append(object.metadata().length()).append("'></biscuit-point>");
|
||||
});
|
||||
html.append("</biscuit-series></biscuit-chartview></section>");
|
||||
}
|
||||
html.append("<section class=buckets id=configuration><h2>Bucket settings</h2>")
|
||||
.append("<div class=detail-grid><div class=detail-card><h3>Access</h3>")
|
||||
.append(fact("Ownership", ownership(bucket.ownership())))
|
||||
.append(fact("Block public ACLs", yesNo(bucket.publicAccessBlock().blockPublicAcls())))
|
||||
.append(fact("Ignore public ACLs", yesNo(bucket.publicAccessBlock().ignorePublicAcls())))
|
||||
.append(fact("Block public policy", yesNo(bucket.publicAccessBlock().blockPublicPolicy())))
|
||||
.append(fact("Restrict public buckets", yesNo(bucket.publicAccessBlock().restrictPublicBuckets())))
|
||||
.append("</div><div class=detail-card><h3>Lifecycle</h3>")
|
||||
.append(fact("Created", time(bucket.created())))
|
||||
.append(fact("Versioning", versioning(bucket.versioning())))
|
||||
.append(fact("Policy", bucket.policy() == null ? "None" : "Configured"))
|
||||
.append("</div></div>");
|
||||
if (bucket.policy() != null)
|
||||
html.append("<details><summary>Bucket policy</summary><pre>")
|
||||
.append(AdminConsole.escape(bucket.policy())).append("</pre></details>");
|
||||
if (!bucket.acl().isEmpty())
|
||||
html.append(attributes("Bucket grants", bucket.acl()));
|
||||
html.append("</section>");
|
||||
return html.toString();
|
||||
}
|
||||
|
||||
static String object(ObjectStorage store, String rawQuery, String csrf) throws IOException {
|
||||
Map<String, String> query = query(rawQuery, Set.of("bucket", "key"));
|
||||
String bucketName = required(query, "bucket", 255);
|
||||
String key = required(query, "key", 1024);
|
||||
store.bucket(bucketName);
|
||||
ObjectStorage.Metadata meta;
|
||||
try (ObjectStorage.OpenObject opened = store.open(bucketName, key)) {
|
||||
meta = opened.metadata();
|
||||
}
|
||||
int slash = key.lastIndexOf('/');
|
||||
String prefix = slash < 0 ? "" : key.substring(0, slash + 1);
|
||||
StringBuilder html = new StringBuilder(AdminConsole.consoleHeader(csrf));
|
||||
html.append(breadcrumbs(bucketName, prefix))
|
||||
.append("<div class=intro><div><h2 class=name-cell>")
|
||||
.append(AdminConsole.escape(key.endsWith("/") ? "(folder marker)" : key.substring(prefix.length())))
|
||||
.append("</h2><p>Object metadata · content is not loaded in this view</p></div>")
|
||||
.append("<biscuit-badgeview theme=dark variant=accent>Object</biscuit-badgeview></div>")
|
||||
.append("<div class=grid><biscuit-cardview><small>Size</small><strong>")
|
||||
.append(AdminConsole.formatBytes(meta.length()))
|
||||
.append("</strong></biscuit-cardview><biscuit-cardview><small>Content type</small><strong>")
|
||||
.append(AdminConsole.escape(meta.contentType() == null ? "Unknown" : meta.contentType()))
|
||||
.append("</strong></biscuit-cardview><biscuit-cardview><small>Modified</small><strong>")
|
||||
.append(time(meta.modified())).append("</strong></biscuit-cardview></div>")
|
||||
.append("<div class=detail-grid><div class=detail-card><h3>Identity</h3>")
|
||||
.append(fact("Bucket", bucketName)).append(fact("Key", key))
|
||||
.append(fact("Version ID", meta.versionId() == null ? "Unversioned" : meta.versionId()))
|
||||
.append("</div><div class=detail-card><h3>Integrity</h3>")
|
||||
.append(fact("ETag", meta.etag() == null ? "—" : meta.etag()))
|
||||
.append(fact("SHA-256", meta.sha256() == null ? "—" :
|
||||
java.util.HexFormat.of().formatHex(meta.sha256())))
|
||||
.append("</div></div>")
|
||||
.append(attributes("User metadata", meta.userMetadata()))
|
||||
.append(attributes("Tags", meta.tags()))
|
||||
.append(attributes("Checksums", meta.checksums()))
|
||||
.append(attributes("ACL grants", meta.acl()));
|
||||
return html.toString();
|
||||
}
|
||||
|
||||
static String bucketUrl(String name, String prefix, String after) {
|
||||
StringBuilder url = new StringBuilder(AdminConsole.PATH + "/bucket?name=" + encoded(name));
|
||||
if (!prefix.isEmpty()) url.append("&prefix=").append(encoded(prefix));
|
||||
if (after != null) url.append("&after=").append(encoded(after));
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
private static String objectUrl(String bucket, String key) {
|
||||
return AdminConsole.PATH + "/object?bucket=" + encoded(bucket) + "&key=" + encoded(key);
|
||||
}
|
||||
|
||||
private static String indexUrl(String filter, String after) {
|
||||
StringBuilder url = new StringBuilder(AdminConsole.PATH + "/buckets?filter=" + encoded(filter));
|
||||
if (after != null) url.append("&after=").append(encoded(after));
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
private static String breadcrumbs(String bucket, String prefix) {
|
||||
StringBuilder html = new StringBuilder("<nav class=crumbs aria-label=Breadcrumb><a href='")
|
||||
.append(AdminConsole.PATH).append("/buckets'>Buckets</a><span>/</span>");
|
||||
if (prefix.isEmpty()) {
|
||||
html.append("<span>").append(AdminConsole.escape(bucket)).append("</span>");
|
||||
} else {
|
||||
html.append("<a href='").append(bucketUrl(bucket, "", null)).append("'>")
|
||||
.append(AdminConsole.escape(bucket)).append("</a>");
|
||||
int from = 0;
|
||||
while (from < prefix.length()) {
|
||||
int slash = prefix.indexOf('/', from);
|
||||
if (slash < 0) break;
|
||||
String current = prefix.substring(0, slash + 1);
|
||||
String label = prefix.substring(from, slash + 1);
|
||||
html.append("<span>/</span><a href='").append(bucketUrl(bucket, current, null))
|
||||
.append("'>").append(AdminConsole.escape(label)).append("</a>");
|
||||
from = slash + 1;
|
||||
}
|
||||
}
|
||||
return html.append("</nav>").toString();
|
||||
}
|
||||
|
||||
private static String parentPrefix(String prefix) {
|
||||
int last = prefix.lastIndexOf('/', prefix.length() - 2);
|
||||
return last < 0 ? "" : prefix.substring(0, last + 1);
|
||||
}
|
||||
|
||||
private static String attributes(String title, Map<String, String> values) {
|
||||
if (values == null || values.isEmpty()) return "";
|
||||
StringBuilder html = new StringBuilder("<details><summary>")
|
||||
.append(AdminConsole.escape(title)).append(" (" + values.size() + ")</summary>")
|
||||
.append("<div class=table-wrap><table><thead><tr><th>Name</th><th>Value</th></tr></thead><tbody>");
|
||||
values.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEach(entry ->
|
||||
html.append("<tr><td class=name-cell>").append(AdminConsole.escape(entry.getKey()))
|
||||
.append("</td><td class=name-cell>").append(AdminConsole.escape(entry.getValue() == null ? "" : entry.getValue()))
|
||||
.append("</td></tr>"));
|
||||
return html.append("</tbody></table></div></details>").toString();
|
||||
}
|
||||
|
||||
private static String fact(String name, String value) {
|
||||
return "<div class=fact><span>" + AdminConsole.escape(name) + "</span><strong>" +
|
||||
AdminConsole.escape(value) + "</strong></div>";
|
||||
}
|
||||
|
||||
private static String versioning(ObjectStorage.VersioningState state) {
|
||||
return switch (state) {
|
||||
case NEVER -> "Off";
|
||||
case ENABLED -> "Enabled";
|
||||
case SUSPENDED -> "Suspended";
|
||||
};
|
||||
}
|
||||
|
||||
private static String ownership(ObjectStorage.ObjectOwnership value) {
|
||||
return switch (value) {
|
||||
case BUCKET_OWNER_ENFORCED -> "Owner enforced";
|
||||
case BUCKET_OWNER_PREFERRED -> "Owner preferred";
|
||||
case OBJECT_WRITER -> "Object writer";
|
||||
};
|
||||
}
|
||||
|
||||
private static String yesNo(boolean value) {
|
||||
return value ? "On" : "Off";
|
||||
}
|
||||
|
||||
private static String time(long epochMillis) {
|
||||
return TIME.format(Instant.ofEpochMilli(epochMillis));
|
||||
}
|
||||
|
||||
private static String encoded(String value) {
|
||||
return URLEncoder.encode(value, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
private static String required(Map<String, String> values, String name, int limit) {
|
||||
String value = values.get(name);
|
||||
if (value == null || value.isEmpty() || value.length() > limit) throw invalidQuery();
|
||||
return value;
|
||||
}
|
||||
|
||||
private static Map<String, String> query(String raw, Set<String> allowed) {
|
||||
if (raw == null || raw.isEmpty()) return Map.of();
|
||||
if (raw.length() > 8192) throw invalidQuery();
|
||||
Map<String, String> values = new HashMap<>();
|
||||
try {
|
||||
for (String field : raw.split("&", -1)) {
|
||||
int equal = field.indexOf('=');
|
||||
if (equal < 0) throw invalidQuery();
|
||||
String name = URLDecoder.decode(field.substring(0, equal), StandardCharsets.UTF_8);
|
||||
String value = URLDecoder.decode(field.substring(equal + 1), StandardCharsets.UTF_8);
|
||||
if (!allowed.contains(name) || values.putIfAbsent(name, value) != null)
|
||||
throw invalidQuery();
|
||||
}
|
||||
} catch (IllegalArgumentException badEncoding) {
|
||||
throw invalidQuery();
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
private static StoreException invalidQuery() {
|
||||
return new StoreException(400, "InvalidArgument", "Invalid browser link or search");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,703 @@
|
||||
package cloud.lunarsky.store;
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.SecureRandom;
|
||||
import java.time.Duration;
|
||||
import java.util.Base64;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
final class AdminConsole {
|
||||
static final String PATH = "/_objectstore/admin";
|
||||
private static final String STYLE = """
|
||||
:root { color-scheme: dark; }
|
||||
body { background: #14121d; color: #f4f0fa; font: 16px system-ui; margin: 0;
|
||||
padding: clamp(20px, 4vw, 48px); }
|
||||
main { max-width: 1080px; margin: 0 auto; }
|
||||
.login { min-height: calc(100dvh - 2 * clamp(20px, 4vw, 48px));
|
||||
display: grid; place-items: center; }
|
||||
.login-card { width: min(100%, 400px); box-sizing: border-box; padding: 34px;
|
||||
border: 1px solid #514663; border-radius: 18px; background: #211c2b;
|
||||
box-shadow: 0 24px 80px #08060d88; }
|
||||
.mark { display: grid; place-items: center; width: 48px; height: 48px; flex: none; }
|
||||
.mark img { width: 56px; height: 56px; max-width: none; }
|
||||
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
|
||||
.login-brand strong { font-size: 1.1rem; }
|
||||
.login-card h1 { font-size: 1.75rem; }
|
||||
.login-card .muted { margin-bottom: 28px; line-height: 1.5; }
|
||||
h1 { margin: 0; font-size: 2rem; }
|
||||
header { display: flex; justify-content: space-between; align-items: center; gap: 16px;
|
||||
border-bottom: 1px solid #3e344e; padding-bottom: 22px; }
|
||||
.header-title { display: flex; align-items: center; gap: 14px; }
|
||||
.header-title h1 { font-size: 1.35rem; }
|
||||
.header-title small { margin-top: 3px; }
|
||||
.intro { display: flex; align-items: center; justify-content: space-between;
|
||||
gap: 16px; margin: 34px 0 18px; }
|
||||
.intro h2, .buckets h2 { margin: 0 0 6px; font-size: 1.3rem; }
|
||||
.intro p, .buckets p { margin: 0; color: #aaa2bb; }
|
||||
.muted, small { color: #aaa2bb; }
|
||||
.error { color: #ffafa9; }
|
||||
form { margin-top: 24px; }
|
||||
label { display: block; margin-bottom: 8px; }
|
||||
input, button { font: inherit; border: 1px solid #514663; border-radius: 8px;
|
||||
padding: 12px 14px; }
|
||||
input { display: block; width: min(100%, 360px); box-sizing: border-box;
|
||||
background: #211c2b; color: #fff; }
|
||||
input[type=hidden] { display: none; }
|
||||
.login input[type=password], .login button { width: 100%; }
|
||||
button { background: #b39add; color: #20172c; cursor: pointer; }
|
||||
form button { margin-top: 12px; }
|
||||
header form { margin: 0; }
|
||||
header button { background: #282232; color: #eee; }
|
||||
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||
gap: 14px; }
|
||||
biscuit-cardview { display: block; --biscuit-cardview-background: #211c2b;
|
||||
--biscuit-cardview-border: 1px solid #463a58;
|
||||
--biscuit-cardview-radius: 14px;
|
||||
--biscuit-cardview-padding: 22px;
|
||||
--biscuit-cardview-color: #f4f0fa; }
|
||||
biscuit-cardview:not(:defined) { background: #211c2b; border: 1px solid #463a58;
|
||||
border-radius: 14px; padding: 22px; }
|
||||
biscuit-cardview small { display: block; margin-bottom: 12px; }
|
||||
biscuit-cardview strong { display: block; font-size: 1.2rem; overflow-wrap: anywhere; }
|
||||
biscuit-badgeview:not(:defined) { display: inline-block; padding: 6px 10px;
|
||||
border-radius: 999px; background: #342844; color: #d9c6f5; font-size: .8rem; }
|
||||
.buckets { margin-top: 34px; }
|
||||
.table-wrap { overflow: auto; margin-top: 18px; border: 1px solid #463a58;
|
||||
border-radius: 14px; background: #211c2b; }
|
||||
table { width: 100%; border-collapse: collapse; text-align: left; }
|
||||
th, td { padding: 15px 18px; border-bottom: 1px solid #3b314b; white-space: nowrap; }
|
||||
tr:last-child td { border-bottom: 0; }
|
||||
th { color: #aaa2bb; font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; }
|
||||
td { font-size: .93rem; }
|
||||
.empty { padding: 28px; color: #aaa2bb; }
|
||||
a { color: #c6a8f3; text-decoration: none; }
|
||||
a:hover { text-decoration: underline; }
|
||||
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
|
||||
color: #aaa2bb; font-size: .9rem; margin: 30px 0 12px; }
|
||||
.crumbs span { overflow-wrap: anywhere; }
|
||||
.toolbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between;
|
||||
gap: 16px; margin: 22px 0; }
|
||||
.toolbar form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin: 0; }
|
||||
.toolbar label { margin: 0; color: #aaa2bb; font-size: .85rem; }
|
||||
.toolbar input { min-width: min(280px, 100%); }
|
||||
.toolbar button { margin: 0; }
|
||||
.toolbar .field { display: grid; gap: 6px; }
|
||||
.button-link { display: inline-flex; align-items: center; justify-content: center;
|
||||
border: 1px solid #514663; border-radius: 8px; padding: 12px 14px;
|
||||
color: #f4f0fa; background: #282232; }
|
||||
.button-link:hover { background: #342a42; text-decoration: none; }
|
||||
.name-cell { max-width: 420px; white-space: normal; overflow-wrap: anywhere; }
|
||||
.kind { color: #aaa2bb; font-size: .8rem; }
|
||||
.pagination { display: flex; gap: 12px; align-items: center; margin-top: 18px; }
|
||||
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
||||
gap: 14px; margin-top: 22px; }
|
||||
.detail-card { border: 1px solid #463a58; border-radius: 14px; background: #211c2b;
|
||||
padding: 22px; min-width: 0; }
|
||||
.detail-card h3 { margin: 0 0 16px; font-size: 1rem; }
|
||||
.fact { display: flex; align-items: baseline; justify-content: space-between;
|
||||
gap: 16px; padding: 9px 0; border-top: 1px solid #3b314b; }
|
||||
.fact span { color: #aaa2bb; }
|
||||
.fact strong { text-align: right; overflow-wrap: anywhere; }
|
||||
.insight { margin-top: 26px; }
|
||||
.console-nav { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0;
|
||||
border-bottom: 1px solid #3e344e; }
|
||||
.console-nav a { padding: 8px 12px; border-radius: 8px; color: #cfc5df; }
|
||||
.console-nav a:hover { background: #282232; text-decoration: none; }
|
||||
.perf-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 14px; margin-top: 24px; }
|
||||
.perf-grid biscuit-cardview strong { font-variant-numeric: tabular-nums; }
|
||||
.perf-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 16px; margin-top: 24px; }
|
||||
.perf-charts[hidden] { display: none; }
|
||||
.perf-status { color: #aaa2bb; margin-top: 12px; min-height: 24px; }
|
||||
.perf-note { color: #aaa2bb; font-size: .9rem; line-height: 1.5; }
|
||||
biscuit-chartview { --biscuit-chart-surface: #211c2b;
|
||||
--biscuit-chart-color: #f4f0fa;
|
||||
--biscuit-chart-muted: #aaa2bb;
|
||||
--biscuit-chart-border: #463a58;
|
||||
--biscuit-chart-accent: #b39add; }
|
||||
details { margin-top: 22px; padding: 18px 22px; border: 1px solid #463a58;
|
||||
border-radius: 14px; background: #211c2b; }
|
||||
summary { cursor: pointer; font-weight: 600; }
|
||||
pre { overflow-wrap: anywhere; white-space: pre-wrap; }
|
||||
@media (max-width: 820px) { .perf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
|
||||
@media (max-width: 520px) {
|
||||
.login-card { padding: 26px; }
|
||||
.intro { align-items: start; }
|
||||
.grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
|
||||
.grid biscuit-cardview { --biscuit-cardview-padding: 16px; }
|
||||
.perf-grid biscuit-cardview { --biscuit-cardview-padding: 16px; }
|
||||
.perf-grid biscuit-cardview small { margin-bottom: 8px; }
|
||||
.perf-charts { grid-template-columns: minmax(0, 1fr); }
|
||||
}
|
||||
""";
|
||||
private static final long SESSION_MILLIS = Duration.ofMinutes(30).toMillis();
|
||||
private static final long ATTEMPT_WINDOW_MILLIS = Duration.ofMinutes(5).toMillis();
|
||||
private static final int MAX_SESSIONS = 128;
|
||||
private static final int MAX_CLIENTS = 1024;
|
||||
private final ObjectStorage store;
|
||||
private final byte[] passwordHash;
|
||||
private final URI publicOrigin;
|
||||
private final String biscuitScript;
|
||||
private final String performanceScript;
|
||||
private final byte[] logo;
|
||||
private volatile RequestMetrics metrics;
|
||||
private final SecureRandom random = new SecureRandom();
|
||||
private final LinkedHashMap<String, Session> sessions = new LinkedHashMap<>();
|
||||
private final LinkedHashMap<String, Long> loginTokens = new LinkedHashMap<>();
|
||||
private final LinkedHashMap<String, Attempt> attempts = new LinkedHashMap<>();
|
||||
|
||||
private record Attempt(long started, int failures) { }
|
||||
private record Session(long expires, String csrf) { }
|
||||
|
||||
private AdminConsole(ObjectStorage store, byte[] passwordHash, URI publicOrigin,
|
||||
String biscuitScript, String performanceScript, byte[] logo) {
|
||||
this.store = store;
|
||||
this.passwordHash = passwordHash;
|
||||
this.publicOrigin = publicOrigin;
|
||||
this.biscuitScript = biscuitScript;
|
||||
this.performanceScript = performanceScript;
|
||||
this.logo = logo;
|
||||
}
|
||||
|
||||
void setMetrics(RequestMetrics metrics) { this.metrics = metrics; }
|
||||
|
||||
static AdminConsole fromEnvironment(Map<String, String> env, ObjectStorage store) throws IOException {
|
||||
String enabled = env.getOrDefault("ADMIN_UI_ENABLED", "false");
|
||||
if (enabled.equals("false")) return null;
|
||||
if (!enabled.equals("true")) throw new IllegalArgumentException("Invalid ADMIN_UI_ENABLED");
|
||||
String file = env.get("ADMIN_UI_PASSWORD_FILE");
|
||||
if (file == null || file.isBlank())
|
||||
throw new IllegalArgumentException("ADMIN_UI_PASSWORD_FILE is required when the admin UI is enabled");
|
||||
byte[] password = Files.readAllBytes(Path.of(file));
|
||||
int length = password.length;
|
||||
if (length > 0 && password[length - 1] == '\n') length--;
|
||||
if (length > 0 && password[length - 1] == '\r') length--;
|
||||
if (length < 16 || length > 1024)
|
||||
throw new IllegalArgumentException("Admin password must contain 16 to 1024 bytes");
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (password[i] == '\n' || password[i] == '\r' || password[i] == 0)
|
||||
throw new IllegalArgumentException("Admin password must be a single line");
|
||||
}
|
||||
byte[] trimmed = java.util.Arrays.copyOf(password, length);
|
||||
byte[] hash = SigV4.hash(trimmed);
|
||||
java.util.Arrays.fill(trimmed, (byte) 0);
|
||||
java.util.Arrays.fill(password, (byte) 0);
|
||||
String configured = env.get("ADMIN_UI_ORIGIN");
|
||||
URI origin = null;
|
||||
if (configured != null && !configured.isBlank()) {
|
||||
try { origin = URI.create(configured); }
|
||||
catch (IllegalArgumentException error) {
|
||||
throw new IllegalArgumentException("Invalid ADMIN_UI_ORIGIN", error);
|
||||
}
|
||||
if (!"https".equals(origin.getScheme()) || origin.getHost() == null ||
|
||||
origin.getUserInfo() != null || origin.getRawQuery() != null || origin.getRawFragment() != null ||
|
||||
!(origin.getRawPath().isEmpty() || origin.getRawPath().equals("/")))
|
||||
throw new IllegalArgumentException("ADMIN_UI_ORIGIN must be an HTTPS origin");
|
||||
origin = URI.create(origin.toString().replaceFirst("/$", ""));
|
||||
}
|
||||
return new AdminConsole(store, hash, origin,
|
||||
Files.readString(Path.of("admin-ui/biscuit.js")),
|
||||
Files.readString(Path.of("admin-ui/performance.js")),
|
||||
Files.readAllBytes(Path.of("admin-ui/objectstore-logo.png")));
|
||||
}
|
||||
|
||||
void handle(HttpExchange exchange) throws IOException {
|
||||
securityHeaders(exchange);
|
||||
String origin = requestOrigin(exchange);
|
||||
if (origin == null) {
|
||||
send(exchange, 403, page("<h1>Admin console unavailable</h1>" +
|
||||
"<p>Open the local console at <code>http://127.0.0.1:<port>" + PATH +
|
||||
"/login</code>, or use the configured HTTPS origin.</p>"), "text/html; charset=utf-8");
|
||||
return;
|
||||
}
|
||||
String path = exchange.getRequestURI().getRawPath();
|
||||
String method = exchange.getRequestMethod();
|
||||
if (path.equals(PATH) || path.equals(PATH + "/")) {
|
||||
if (!method.equals("GET")) {
|
||||
methodNotAllowed(exchange, "GET");
|
||||
return;
|
||||
}
|
||||
if (session(exchange) != null) redirect(exchange, PATH + "/overview");
|
||||
else redirect(exchange, PATH + "/login");
|
||||
return;
|
||||
}
|
||||
if (path.equals(PATH + "/login")) {
|
||||
if (method.equals("GET")) {
|
||||
send(exchange, 200, loginPage("", issueLoginToken()), "text/html; charset=utf-8");
|
||||
return;
|
||||
}
|
||||
if (method.equals("POST")) {
|
||||
login(exchange);
|
||||
return;
|
||||
}
|
||||
methodNotAllowed(exchange, "GET, POST");
|
||||
return;
|
||||
}
|
||||
if (path.equals(PATH + "/style.css")) {
|
||||
if (!method.equals("GET")) {
|
||||
methodNotAllowed(exchange, "GET");
|
||||
return;
|
||||
}
|
||||
send(exchange, 200, STYLE, "text/css; charset=utf-8");
|
||||
return;
|
||||
}
|
||||
if (path.equals(PATH + "/logo.png")) {
|
||||
if (!method.equals("GET")) {
|
||||
methodNotAllowed(exchange, "GET");
|
||||
return;
|
||||
}
|
||||
exchange.getResponseHeaders().set("Content-Type", "image/png");
|
||||
exchange.sendResponseHeaders(200, logo.length);
|
||||
exchange.getResponseBody().write(logo);
|
||||
return;
|
||||
}
|
||||
if (path.equals(PATH + "/biscuit.js")) {
|
||||
if (!method.equals("GET")) {
|
||||
methodNotAllowed(exchange, "GET");
|
||||
return;
|
||||
}
|
||||
if (session(exchange) == null) {
|
||||
redirect(exchange, PATH + "/login");
|
||||
return;
|
||||
}
|
||||
send(exchange, 200, biscuitScript, "text/javascript; charset=utf-8");
|
||||
return;
|
||||
}
|
||||
if (path.equals(PATH + "/performance.js")) {
|
||||
if (!method.equals("GET")) {
|
||||
methodNotAllowed(exchange, "GET");
|
||||
return;
|
||||
}
|
||||
if (session(exchange) == null) {
|
||||
redirect(exchange, PATH + "/login");
|
||||
return;
|
||||
}
|
||||
send(exchange, 200, performanceScript, "text/javascript; charset=utf-8");
|
||||
return;
|
||||
}
|
||||
if (path.equals(PATH + "/performance.json")) {
|
||||
if (!method.equals("GET")) {
|
||||
methodNotAllowed(exchange, "GET");
|
||||
return;
|
||||
}
|
||||
if (session(exchange) == null) {
|
||||
redirect(exchange, PATH + "/login");
|
||||
return;
|
||||
}
|
||||
if (metrics == null) {
|
||||
send(exchange, 503, "Metrics unavailable", "text/plain; charset=utf-8");
|
||||
return;
|
||||
}
|
||||
send(exchange, 200, AdminPerformance.snapshot(metrics), "application/json; charset=utf-8");
|
||||
return;
|
||||
}
|
||||
if (path.equals(PATH + "/logout")) {
|
||||
if (!method.equals("POST")) {
|
||||
methodNotAllowed(exchange, "POST");
|
||||
return;
|
||||
}
|
||||
Session session = session(exchange);
|
||||
Map<String, String> form = readForm(exchange);
|
||||
if (session == null || !MessageDigest.isEqual(session.csrf().getBytes(StandardCharsets.US_ASCII),
|
||||
form.getOrDefault("csrf", "").getBytes(StandardCharsets.US_ASCII))) {
|
||||
send(exchange, 403, "Invalid sign-out request", "text/plain; charset=utf-8");
|
||||
return;
|
||||
}
|
||||
String token = sessionCookie(exchange);
|
||||
synchronized (this) {
|
||||
sessions.remove(token);
|
||||
}
|
||||
exchange.getResponseHeaders().add("Set-Cookie", cookie("", 0));
|
||||
redirect(exchange, PATH + "/login");
|
||||
return;
|
||||
}
|
||||
if (path.equals(PATH + "/overview")) {
|
||||
if (!method.equals("GET")) {
|
||||
methodNotAllowed(exchange, "GET");
|
||||
return;
|
||||
}
|
||||
Session session = session(exchange);
|
||||
if (session == null) {
|
||||
redirect(exchange, PATH + "/login");
|
||||
return;
|
||||
}
|
||||
ObjectStorage.Limits limits = store.limits();
|
||||
String mode = store instanceof ClusterStore ? "Cluster" : "Disk";
|
||||
String status = store.ready() ? "Ready" : "Unavailable";
|
||||
List<ObjectStorage.Bucket> buckets;
|
||||
boolean bucketListAvailable;
|
||||
try {
|
||||
buckets = store.buckets();
|
||||
bucketListAvailable = true;
|
||||
} catch (IOException unavailable) {
|
||||
buckets = List.of();
|
||||
bucketListAvailable = false;
|
||||
}
|
||||
send(exchange, 200, overviewPage(mode, status, limits.maxObjectBytes(), limits.maxTotalBytes(),
|
||||
buckets, bucketListAvailable, session.csrf()),
|
||||
"text/html; charset=utf-8");
|
||||
return;
|
||||
}
|
||||
if (path.equals(PATH + "/performance")) {
|
||||
if (!method.equals("GET")) {
|
||||
methodNotAllowed(exchange, "GET");
|
||||
return;
|
||||
}
|
||||
Session session = session(exchange);
|
||||
if (session == null) {
|
||||
redirect(exchange, PATH + "/login");
|
||||
return;
|
||||
}
|
||||
send(exchange, 200, performancePage(session.csrf()), "text/html; charset=utf-8");
|
||||
return;
|
||||
}
|
||||
if (path.equals(PATH + "/buckets") || path.equals(PATH + "/bucket") ||
|
||||
path.equals(PATH + "/object")) {
|
||||
if (!method.equals("GET")) {
|
||||
methodNotAllowed(exchange, "GET");
|
||||
return;
|
||||
}
|
||||
Session session = session(exchange);
|
||||
if (session == null) {
|
||||
redirect(exchange, PATH + "/login");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
String body = path.equals(PATH + "/buckets") ?
|
||||
AdminBrowser.index(store, exchange.getRequestURI().getRawQuery(), session.csrf()) :
|
||||
path.equals(PATH + "/bucket") ?
|
||||
AdminBrowser.bucket(store, exchange.getRequestURI().getRawQuery(), session.csrf()) :
|
||||
AdminBrowser.object(store, exchange.getRequestURI().getRawQuery(), session.csrf());
|
||||
send(exchange, 200, page(body, true), "text/html; charset=utf-8");
|
||||
} catch (StoreException error) {
|
||||
send(exchange, error.status, page(consoleHeader(session.csrf()) +
|
||||
"<div class=crumbs><a href='" + PATH + "/buckets'>Buckets</a></div>" +
|
||||
"<h2>Could not open this view</h2><p class=muted>" + escape(error.getMessage()) + "</p>"),
|
||||
"text/html; charset=utf-8");
|
||||
} catch (IOException unavailable) {
|
||||
send(exchange, 503, page(consoleHeader(session.csrf()) +
|
||||
"<h2>Storage unavailable</h2><p class=muted>Try again when the service is ready.</p>"),
|
||||
"text/html; charset=utf-8");
|
||||
}
|
||||
return;
|
||||
}
|
||||
send(exchange, 404, "Not found", "text/plain; charset=utf-8");
|
||||
}
|
||||
|
||||
private void login(HttpExchange exchange) throws IOException {
|
||||
Map<String, String> form = readForm(exchange);
|
||||
if (!consumeLoginToken(form.get("csrf"))) {
|
||||
send(exchange, 403, loginPage("Sign-in expired. Reload the page and try again.", issueLoginToken()),
|
||||
"text/html; charset=utf-8");
|
||||
return;
|
||||
}
|
||||
String password = form.get("password");
|
||||
String client = exchange.getRemoteAddress().getAddress().getHostAddress();
|
||||
if (throttled(client)) {
|
||||
exchange.getResponseHeaders().set("Retry-After", "300");
|
||||
send(exchange, 429, loginPage("Too many attempts. Try again in five minutes.", issueLoginToken()),
|
||||
"text/html; charset=utf-8");
|
||||
return;
|
||||
}
|
||||
byte[] candidate = SigV4.hash((password == null ? "" : password).getBytes(StandardCharsets.UTF_8));
|
||||
if (!MessageDigest.isEqual(candidate, passwordHash)) {
|
||||
failed(client);
|
||||
send(exchange, 401, loginPage("Invalid password", issueLoginToken()), "text/html; charset=utf-8");
|
||||
return;
|
||||
}
|
||||
String token = randomToken();
|
||||
synchronized (this) {
|
||||
attempts.remove(client);
|
||||
long now = System.currentTimeMillis();
|
||||
sessions.entrySet().removeIf(entry -> entry.getValue().expires() <= now);
|
||||
if (sessions.size() >= MAX_SESSIONS) sessions.remove(sessions.keySet().iterator().next());
|
||||
sessions.put(token, new Session(now + SESSION_MILLIS, randomToken()));
|
||||
}
|
||||
exchange.getResponseHeaders().add("Set-Cookie", cookie(token, 1800));
|
||||
redirect(exchange, PATH + "/overview");
|
||||
}
|
||||
|
||||
private static Map<String, String> readForm(HttpExchange exchange) throws IOException {
|
||||
String contentType = exchange.getRequestHeaders().getFirst("Content-Type");
|
||||
if (contentType == null || !contentType.split(";", 2)[0].trim()
|
||||
.equalsIgnoreCase("application/x-www-form-urlencoded")) {
|
||||
throw new StoreException(415, "InvalidRequest", "Expected a form submission");
|
||||
}
|
||||
byte[] body = exchange.getRequestBody().readNBytes(4097);
|
||||
if (body.length > 4096) {
|
||||
throw new StoreException(413, "InvalidRequest", "Form is too large");
|
||||
}
|
||||
Map<String, String> values = new java.util.HashMap<>();
|
||||
try {
|
||||
for (String field : new String(body, StandardCharsets.UTF_8).split("&", -1)) {
|
||||
int split = field.indexOf('=');
|
||||
if (split < 0) continue;
|
||||
String key = URLDecoder.decode(field.substring(0, split), StandardCharsets.UTF_8);
|
||||
String value = URLDecoder.decode(field.substring(split + 1), StandardCharsets.UTF_8);
|
||||
if (values.putIfAbsent(key, value) != null)
|
||||
throw new IllegalArgumentException("Duplicate form field");
|
||||
}
|
||||
} catch (IllegalArgumentException error) {
|
||||
throw new StoreException(400, "InvalidRequest", "Invalid form submission");
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
private synchronized String issueLoginToken() {
|
||||
long now = System.currentTimeMillis();
|
||||
loginTokens.entrySet().removeIf(entry -> entry.getValue() <= now);
|
||||
if (loginTokens.size() >= MAX_SESSIONS) loginTokens.remove(loginTokens.keySet().iterator().next());
|
||||
String token = randomToken();
|
||||
loginTokens.put(token, now + Duration.ofMinutes(10).toMillis());
|
||||
return token;
|
||||
}
|
||||
|
||||
private synchronized boolean consumeLoginToken(String token) {
|
||||
if (token == null || !token.matches("[A-Za-z0-9_-]{43}")) return false;
|
||||
Long until = loginTokens.remove(token);
|
||||
return until != null && until > System.currentTimeMillis();
|
||||
}
|
||||
|
||||
private String randomToken() {
|
||||
byte[] value = new byte[32];
|
||||
random.nextBytes(value);
|
||||
return Base64.getUrlEncoder().withoutPadding().encodeToString(value);
|
||||
}
|
||||
|
||||
private synchronized boolean throttled(String client) {
|
||||
Attempt attempt = attempts.get(client);
|
||||
return attempt != null && System.currentTimeMillis() - attempt.started < ATTEMPT_WINDOW_MILLIS &&
|
||||
attempt.failures >= 5;
|
||||
}
|
||||
|
||||
private synchronized void failed(String client) {
|
||||
long now = System.currentTimeMillis();
|
||||
Attempt attempt = attempts.get(client);
|
||||
if (attempt == null || now - attempt.started >= ATTEMPT_WINDOW_MILLIS)
|
||||
attempts.put(client, new Attempt(now, 1));
|
||||
else attempts.put(client, new Attempt(attempt.started, attempt.failures + 1));
|
||||
if (attempts.size() > MAX_CLIENTS) {
|
||||
Iterator<String> oldest = attempts.keySet().iterator();
|
||||
oldest.next();
|
||||
oldest.remove();
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized Session session(HttpExchange exchange) {
|
||||
String token = sessionCookie(exchange);
|
||||
Session session = sessions.get(token);
|
||||
if (session == null) return null;
|
||||
if (session.expires() > System.currentTimeMillis()) return session;
|
||||
sessions.remove(token);
|
||||
return null;
|
||||
}
|
||||
|
||||
private String sessionCookie(HttpExchange exchange) {
|
||||
String header = exchange.getRequestHeaders().getFirst("Cookie");
|
||||
if (header == null || header.length() > 8192) return "";
|
||||
String name = publicOrigin == null ? "objectstore_admin=" : "__Host-objectstore_admin=";
|
||||
for (String field : header.split(";")) {
|
||||
String value = field.trim();
|
||||
if (value.startsWith(name) && value.substring(name.length()).matches("[A-Za-z0-9_-]{43}"))
|
||||
return value.substring(name.length());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private String cookie(String token, int seconds) {
|
||||
String name = publicOrigin == null ? "objectstore_admin" : "__Host-objectstore_admin";
|
||||
String path = publicOrigin == null ? PATH : "/";
|
||||
return name + "=" + token + "; Path=" + path + "; HttpOnly; SameSite=Strict; Max-Age=" + seconds +
|
||||
(publicOrigin == null ? "" : "; Secure");
|
||||
}
|
||||
|
||||
private String requestOrigin(HttpExchange exchange) {
|
||||
String host = exchange.getRequestHeaders().getFirst("Host");
|
||||
if (host == null || exchange.getRequestHeaders().get("Host").size() != 1) return null;
|
||||
if (publicOrigin != null)
|
||||
return host.equalsIgnoreCase(publicOrigin.getRawAuthority()) ? publicOrigin.toString() : null;
|
||||
if (!host.matches("(?i)(localhost|127\\.0\\.0\\.1|\\[::1\\])(?::[0-9]{1,5})?")) return null;
|
||||
return "http://" + host.toLowerCase(java.util.Locale.ROOT);
|
||||
}
|
||||
|
||||
private static void securityHeaders(HttpExchange exchange) {
|
||||
exchange.getResponseHeaders().set("Cache-Control", "no-store");
|
||||
exchange.getResponseHeaders().set("Content-Security-Policy",
|
||||
"default-src 'none'; style-src 'self'; style-src-elem 'self' 'unsafe-inline'; " +
|
||||
"style-src-attr 'none'; script-src 'self'; img-src 'self'; connect-src 'self'; form-action 'self'; " +
|
||||
"frame-ancestors 'none'; base-uri 'none'");
|
||||
exchange.getResponseHeaders().set("Referrer-Policy", "no-referrer");
|
||||
exchange.getResponseHeaders().set("X-Frame-Options", "DENY");
|
||||
exchange.getResponseHeaders().set("X-Content-Type-Options", "nosniff");
|
||||
}
|
||||
|
||||
private static void methodNotAllowed(HttpExchange exchange, String methods) throws IOException {
|
||||
exchange.getResponseHeaders().set("Allow", methods);
|
||||
send(exchange, 405, "Method not allowed", "text/plain; charset=utf-8");
|
||||
}
|
||||
|
||||
private static void redirect(HttpExchange exchange, String path) throws IOException {
|
||||
exchange.getResponseHeaders().set("Location", path);
|
||||
exchange.sendResponseHeaders(303, -1);
|
||||
}
|
||||
|
||||
private static void send(HttpExchange exchange, int status, String body, String contentType) throws IOException {
|
||||
byte[] bytes = body.getBytes(StandardCharsets.UTF_8);
|
||||
exchange.getResponseHeaders().set("Content-Type", contentType);
|
||||
exchange.sendResponseHeaders(status, bytes.length);
|
||||
exchange.getResponseBody().write(bytes);
|
||||
}
|
||||
|
||||
private static String loginPage(String error, String csrf) {
|
||||
return page("<div class=login><div class=login-card><div class=login-brand>" +
|
||||
logoMark() + "<strong>ObjectStore</strong></div><h1>Admin console</h1>" +
|
||||
"<p class=muted>Sign in to view this service.</p>" +
|
||||
(error.isEmpty() ? "" : "<p role=alert class=error>" + error + "</p>") +
|
||||
"<form method=post action='" + PATH + "/login'>" +
|
||||
"<input type=hidden name=csrf value='" + csrf + "'>" +
|
||||
"<label for=password>Admin password</label><input id=password name=password type=password " +
|
||||
"autocomplete=current-password required autofocus><button type=submit>Sign in</button>" +
|
||||
"</form></div></div>");
|
||||
}
|
||||
|
||||
private static String overviewPage(String mode, String status, long maxObject, long maxTotal,
|
||||
List<ObjectStorage.Bucket> buckets, boolean bucketListAvailable,
|
||||
String csrf) {
|
||||
StringBuilder content = new StringBuilder(consoleHeader(csrf) +
|
||||
"<div class=intro><div><h2>Overview</h2><p>Service status and configured limits</p></div>" +
|
||||
"<biscuit-badgeview theme=dark variant='" + (status.equals("Ready") ? "success" : "danger") + "'>" +
|
||||
status + "</biscuit-badgeview></div>" +
|
||||
"<div class=grid><biscuit-cardview><small>Storage mode</small><strong>" + mode +
|
||||
"</strong></biscuit-cardview><biscuit-cardview><small>Buckets</small><strong>" +
|
||||
(bucketListAvailable ? buckets.size() : "Unavailable") +
|
||||
"</strong></biscuit-cardview><biscuit-cardview><small>Maximum object</small><strong>" +
|
||||
formatBytes(maxObject) + "</strong></biscuit-cardview><biscuit-cardview>" +
|
||||
"<small>Total storage limit</small><strong>" + formatBytes(maxTotal) +
|
||||
"</strong></biscuit-cardview></div><section class=buckets><h2>Buckets</h2>" +
|
||||
"<p>Read-only view of the first 25 buckets. <a href='" + PATH +
|
||||
"/buckets'>Browse all buckets</a></p>");
|
||||
if (!bucketListAvailable || buckets.isEmpty()) {
|
||||
content.append("<div class='table-wrap empty'>")
|
||||
.append(bucketListAvailable ? "No buckets yet." : "Bucket list unavailable.")
|
||||
.append("</div>");
|
||||
} else {
|
||||
content.append("<div class=table-wrap><table><thead><tr><th>Bucket</th><th>Versioning</th>" +
|
||||
"<th>Ownership</th></tr></thead><tbody>");
|
||||
for (ObjectStorage.Bucket bucket : buckets.stream().limit(25).toList()) {
|
||||
String versioning = bucket.versioning() == ObjectStorage.VersioningState.NEVER ?
|
||||
"Off" : bucket.versioning().name().toLowerCase(java.util.Locale.ROOT);
|
||||
String ownership = switch (bucket.ownership()) {
|
||||
case BUCKET_OWNER_ENFORCED -> "Owner enforced";
|
||||
case BUCKET_OWNER_PREFERRED -> "Owner preferred";
|
||||
case OBJECT_WRITER -> "Object writer";
|
||||
};
|
||||
content.append("<tr><td><a href='").append(AdminBrowser.bucketUrl(bucket.name(), "", null))
|
||||
.append("'>").append(escape(bucket.name())).append("</a></td><td>")
|
||||
.append(versioning).append("</td><td>").append(ownership).append("</td></tr>");
|
||||
}
|
||||
content.append("</tbody></table></div>");
|
||||
}
|
||||
content.append("</section>");
|
||||
return page(content.toString(), true);
|
||||
}
|
||||
|
||||
private static String performancePage(String csrf) {
|
||||
StringBuilder content = new StringBuilder(consoleHeader(csrf));
|
||||
content.append("<div class=intro><div><h2>Performance</h2>")
|
||||
.append("<p>Live S3 traffic and process health</p></div>")
|
||||
.append("<biscuit-badgeview theme=dark variant=accent>Live</biscuit-badgeview></div>")
|
||||
.append("<p class=perf-note>Sampled every 3 seconds while this tab is visible. ")
|
||||
.append("Traffic excludes admin pages and health checks. Charts keep only the last 60 samples ")
|
||||
.append("in this browser tab.</p><p id=perf-state class=perf-status role=status>Collecting samples…</p>")
|
||||
.append("<div class=perf-grid>")
|
||||
.append(perfCard("Requests / second", "perf-rps"))
|
||||
.append(perfCard("Average latency", "perf-latency"))
|
||||
.append(perfCard("Inbound / second", "perf-inbound"))
|
||||
.append(perfCard("Outbound / second", "perf-outbound"))
|
||||
.append(perfCard("Average CPU · recent", "perf-cpu"))
|
||||
.append(perfCard("Process RAM (RSS)", "perf-ram"))
|
||||
.append(perfCard("GC collections", "perf-gc"))
|
||||
.append(perfCard("In flight", "perf-inflight"))
|
||||
.append("</div><div class=perf-charts hidden>")
|
||||
.append("<biscuit-chartview id=perf-requests-chart theme=dark type=line ")
|
||||
.append("name='Requests / second' height=250 max-rows=60></biscuit-chartview>")
|
||||
.append("<biscuit-chartview id=perf-transfer-chart theme=dark type=line ")
|
||||
.append("name='Transfer / second' height=250 max-rows=60></biscuit-chartview>")
|
||||
.append("<biscuit-chartview id=perf-cpu-chart theme=dark type=line ")
|
||||
.append("name='Process CPU' height=250 max-rows=60></biscuit-chartview>")
|
||||
.append("<biscuit-chartview id=perf-memory-chart theme=dark type=line ")
|
||||
.append("name='Process memory' height=250 max-rows=60></biscuit-chartview>")
|
||||
.append("</div><p class=perf-note>Inbound and outbound measure HTTP body bytes, including ")
|
||||
.append("S3 metadata responses. CPU is the process share of available cores. ")
|
||||
.append("GC counts reset when the service restarts.</p>");
|
||||
return page(content.toString(), true, true);
|
||||
}
|
||||
|
||||
private static String perfCard(String label, String id) {
|
||||
return "<biscuit-cardview><small>" + label + "</small><strong id='" + id +
|
||||
"'>—</strong></biscuit-cardview>";
|
||||
}
|
||||
|
||||
private static String page(String content) {
|
||||
return page(content, false);
|
||||
}
|
||||
|
||||
static String page(String content, boolean widgets) {
|
||||
return page(content, widgets, false);
|
||||
}
|
||||
|
||||
private static String page(String content, boolean widgets, boolean performance) {
|
||||
return "<!doctype html><html lang=en><head><meta charset=utf-8>" +
|
||||
"<meta name=viewport content='width=device-width,initial-scale=1'><title>ObjectStore admin</title>" +
|
||||
"<link rel=stylesheet href='" + PATH + "/style.css'>" +
|
||||
(widgets ? "<script defer src='" + PATH + "/biscuit.js'></script>" : "") +
|
||||
(performance ? "<script defer src='" + PATH + "/performance.js'></script>" : "") +
|
||||
"</head><body><main>" +
|
||||
content + "</main></body></html>";
|
||||
}
|
||||
|
||||
static String consoleHeader(String csrf) {
|
||||
return "<header><div class=header-title>" + logoMark() +
|
||||
"<div><h1>ObjectStore</h1><small>Admin console · v" + Version.VALUE +
|
||||
"</small></div></div><form method=post action='" + PATH +
|
||||
"/logout'><input type=hidden name=csrf value='" + csrf +
|
||||
"'><button type=submit>Sign out</button></form></header>" +
|
||||
"<nav class=console-nav aria-label='Admin sections'><a href='" + PATH +
|
||||
"/overview'>Overview</a><a href='" + PATH + "/buckets'>Buckets</a>" +
|
||||
"<a href='" + PATH + "/performance'>Performance</a></nav>";
|
||||
}
|
||||
|
||||
private static String logoMark() {
|
||||
return "<span class=mark aria-hidden=true><img src='" + PATH +
|
||||
"/logo.png' alt='' width=56 height=56></span>";
|
||||
}
|
||||
|
||||
static String escape(String value) {
|
||||
return value.replace("&", "&").replace("<", "<").replace(">", ">")
|
||||
.replace("\"", """).replace("'", "'");
|
||||
}
|
||||
|
||||
static String formatBytes(long bytes) {
|
||||
if (bytes == Long.MAX_VALUE) return "Unlimited";
|
||||
if (bytes < 1024) return bytes + " B";
|
||||
String[] units = { "KiB", "MiB", "GiB", "TiB", "PiB", "EiB" };
|
||||
double value = bytes;
|
||||
int unit = -1;
|
||||
do {
|
||||
value /= 1024;
|
||||
unit++;
|
||||
} while (value >= 1024 && unit < units.length - 1);
|
||||
return String.format(java.util.Locale.ROOT, "%.1f %s", value, units[unit]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package cloud.lunarsky.store;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.management.GarbageCollectorMXBean;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.MemoryMXBean;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
|
||||
final class AdminPerformance {
|
||||
private static final MemoryMXBean MEMORY = ManagementFactory.getMemoryMXBean();
|
||||
private static final List<GarbageCollectorMXBean> COLLECTORS =
|
||||
ManagementFactory.getGarbageCollectorMXBeans();
|
||||
private static final ProcessHandle PROCESS = ProcessHandle.current();
|
||||
private static final Path STATUS = Path.of("/proc/self/status");
|
||||
|
||||
private AdminPerformance() { }
|
||||
|
||||
static String snapshot(RequestMetrics metrics) {
|
||||
RequestMetrics.DataSnapshot traffic = metrics.dataSnapshot();
|
||||
long gcCount = 0;
|
||||
long gcMillis = 0;
|
||||
for (GarbageCollectorMXBean collector : COLLECTORS) {
|
||||
gcCount += Math.max(0, collector.getCollectionCount());
|
||||
gcMillis += Math.max(0, collector.getCollectionTime());
|
||||
}
|
||||
long cpuNanos = PROCESS.info().totalCpuDuration().map(Duration::toNanos).orElse(-1L);
|
||||
return "{\"requests\":" + traffic.requests() +
|
||||
",\"failures4xx\":" + traffic.failures4xx() +
|
||||
",\"failures5xx\":" + traffic.failures5xx() +
|
||||
",\"durationNanos\":" + traffic.durationNanos() +
|
||||
",\"inboundBytes\":" + traffic.inboundBytes() +
|
||||
",\"outboundBytes\":" + traffic.outboundBytes() +
|
||||
",\"inFlight\":" + traffic.inFlight() +
|
||||
",\"cpuNanos\":" + cpuNanos +
|
||||
",\"processors\":" + Runtime.getRuntime().availableProcessors() +
|
||||
",\"rssBytes\":" + rssBytes() +
|
||||
",\"heapBytes\":" + MEMORY.getHeapMemoryUsage().getUsed() +
|
||||
",\"nonHeapBytes\":" + MEMORY.getNonHeapMemoryUsage().getUsed() +
|
||||
",\"gcCount\":" + gcCount +
|
||||
",\"gcMillis\":" + gcMillis + "}";
|
||||
}
|
||||
|
||||
private static long rssBytes() {
|
||||
if (!Files.isReadable(STATUS)) return -1;
|
||||
try (var lines = Files.lines(STATUS)) {
|
||||
String line = lines.filter(value -> value.startsWith("VmRSS:"))
|
||||
.findFirst().orElse("");
|
||||
if (line.isEmpty()) return -1;
|
||||
String value = line.substring("VmRSS:".length()).trim();
|
||||
return Math.multiplyExact(Long.parseLong(value.split("\\s+", 2)[0]), 1024);
|
||||
} catch (IOException | NumberFormatException | ArithmeticException unavailable) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ public final class Main {
|
||||
private final KeyScopes keyScopes;
|
||||
private final RequestMetrics metrics;
|
||||
private final int maxInFlight;
|
||||
private volatile AdminConsole adminConsole;
|
||||
|
||||
Main(DiskStore store, SigV4 authentication, String bucket) throws IOException {
|
||||
this(store, new MultipartStore(store), authentication, bucket);
|
||||
@@ -99,15 +100,39 @@ public final class Main {
|
||||
store.ensureBucket(bucket);
|
||||
}
|
||||
|
||||
void setAdminConsole(AdminConsole adminConsole) {
|
||||
this.adminConsole = adminConsole;
|
||||
if (adminConsole != null) adminConsole.setMetrics(metrics);
|
||||
}
|
||||
|
||||
void handle(HttpExchange exchange) throws IOException {
|
||||
long started = System.nanoTime();
|
||||
boolean admitted = false;
|
||||
boolean dataStarted = false;
|
||||
TrafficMeter traffic = null;
|
||||
ClientLimits.Client client = null;
|
||||
String requestId = UUID.randomUUID().toString();
|
||||
exchange.getResponseHeaders().set("x-amz-request-id", requestId);
|
||||
exchange.getResponseHeaders().set("X-Content-Type-Options", "nosniff");
|
||||
cors.decorate(exchange);
|
||||
try {
|
||||
String path = exchange.getRequestURI().getRawPath();
|
||||
if (!(path.equals(AdminConsole.PATH) || path.startsWith(AdminConsole.PATH + "/") ||
|
||||
path.equals("/health") || path.equals("/ready") || path.equals("/metrics"))) {
|
||||
traffic = TrafficMeter.attach(exchange);
|
||||
metrics.dataStarted();
|
||||
dataStarted = true;
|
||||
}
|
||||
if (path.equals(AdminConsole.PATH) || path.startsWith(AdminConsole.PATH + "/")) {
|
||||
admitted = slots.tryAcquire();
|
||||
if (!admitted) throw new StoreException(503, "SlowDown", "Too many concurrent requests");
|
||||
if (adminConsole == null) {
|
||||
exchange.sendResponseHeaders(404, -1);
|
||||
} else {
|
||||
adminConsole.handle(exchange);
|
||||
}
|
||||
return;
|
||||
}
|
||||
cors.decorate(exchange);
|
||||
client = clientLimits.enter(exchange);
|
||||
admitted = slots.tryAcquire();
|
||||
if (!admitted) throw new StoreException(503, "SlowDown", "Too many concurrent requests");
|
||||
@@ -124,7 +149,11 @@ public final class Main {
|
||||
finally {
|
||||
if (admitted) slots.release();
|
||||
clientLimits.leave(client);
|
||||
metrics.record(exchange.getResponseCode(), System.nanoTime() - started);
|
||||
long elapsed = System.nanoTime() - started;
|
||||
metrics.record(exchange.getResponseCode(), elapsed);
|
||||
if (dataStarted)
|
||||
metrics.dataFinished(exchange.getResponseCode(), elapsed,
|
||||
traffic.inbound(), traffic.outbound());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ final class ObjectStoreServer {
|
||||
new RequestMetrics(env.get("METRICS_BEARER_TOKEN")),
|
||||
IdentityPolicies.fromEnvironment(env, access, allIdentities),
|
||||
publicEndpoint(env));
|
||||
app.setAdminConsole(AdminConsole.fromEnvironment(env, store));
|
||||
int port = Integer.parseInt(env.getOrDefault("PORT", "9000"));
|
||||
var server = HttpServer.create(mode.equals("cluster")
|
||||
? new InetSocketAddress(env.getOrDefault("BIND_ADDRESS", "127.0.0.1"), port)
|
||||
|
||||
@@ -3,6 +3,7 @@ package cloud.lunarsky.store;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.concurrent.atomic.LongAdder;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
final class RequestMetrics {
|
||||
private final String token;
|
||||
@@ -10,6 +11,16 @@ final class RequestMetrics {
|
||||
private final LongAdder failures4xx = new LongAdder();
|
||||
private final LongAdder failures5xx = new LongAdder();
|
||||
private final LongAdder durationNanos = new LongAdder();
|
||||
private final LongAdder dataRequests = new LongAdder();
|
||||
private final LongAdder dataFailures4xx = new LongAdder();
|
||||
private final LongAdder dataFailures5xx = new LongAdder();
|
||||
private final LongAdder dataDurationNanos = new LongAdder();
|
||||
private final LongAdder inboundBytes = new LongAdder();
|
||||
private final LongAdder outboundBytes = new LongAdder();
|
||||
private final AtomicInteger dataInFlight = new AtomicInteger();
|
||||
|
||||
record DataSnapshot(long requests, long failures4xx, long failures5xx,
|
||||
long durationNanos, long inboundBytes, long outboundBytes, int inFlight) { }
|
||||
|
||||
RequestMetrics(String token) {
|
||||
if (token != null && !token.isBlank() && token.length() < 32)
|
||||
@@ -32,12 +43,33 @@ final class RequestMetrics {
|
||||
durationNanos.add(Math.max(0, elapsedNanos));
|
||||
}
|
||||
|
||||
void dataStarted() { dataInFlight.incrementAndGet(); }
|
||||
|
||||
void dataFinished(int status, long elapsedNanos, long inbound, long outbound) {
|
||||
dataRequests.increment();
|
||||
if (status >= 500) dataFailures5xx.increment();
|
||||
else if (status >= 400) dataFailures4xx.increment();
|
||||
dataDurationNanos.add(Math.max(0, elapsedNanos));
|
||||
inboundBytes.add(Math.max(0, inbound));
|
||||
outboundBytes.add(Math.max(0, outbound));
|
||||
dataInFlight.decrementAndGet();
|
||||
}
|
||||
|
||||
DataSnapshot dataSnapshot() {
|
||||
return new DataSnapshot(dataRequests.sum(), dataFailures4xx.sum(),
|
||||
dataFailures5xx.sum(), dataDurationNanos.sum(), inboundBytes.sum(),
|
||||
outboundBytes.sum(), dataInFlight.get());
|
||||
}
|
||||
|
||||
String render(int inFlight) {
|
||||
return "# TYPE objectstore_requests_total counter\nobjectstore_requests_total " + requests.sum() +
|
||||
"\n# TYPE objectstore_responses_4xx_total counter\nobjectstore_responses_4xx_total " + failures4xx.sum() +
|
||||
"\n# TYPE objectstore_responses_5xx_total counter\nobjectstore_responses_5xx_total " + failures5xx.sum() +
|
||||
"\n# TYPE objectstore_request_duration_seconds_total counter\nobjectstore_request_duration_seconds_total " +
|
||||
durationNanos.sum() / 1_000_000_000.0 +
|
||||
"\n# TYPE objectstore_in_flight gauge\nobjectstore_in_flight " + inFlight + "\n";
|
||||
"\n# TYPE objectstore_in_flight gauge\nobjectstore_in_flight " + inFlight +
|
||||
"\n# TYPE objectstore_data_requests_total counter\nobjectstore_data_requests_total " + dataRequests.sum() +
|
||||
"\n# TYPE objectstore_ingress_bytes_total counter\nobjectstore_ingress_bytes_total " + inboundBytes.sum() +
|
||||
"\n# TYPE objectstore_egress_bytes_total counter\nobjectstore_egress_bytes_total " + outboundBytes.sum() + "\n";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package cloud.lunarsky.store;
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
final class TrafficMeter {
|
||||
private long inbound;
|
||||
private long outbound;
|
||||
|
||||
private TrafficMeter() { }
|
||||
|
||||
static TrafficMeter attach(HttpExchange exchange) {
|
||||
TrafficMeter meter = new TrafficMeter();
|
||||
InputStream input = exchange.getRequestBody();
|
||||
OutputStream output = exchange.getResponseBody();
|
||||
exchange.setStreams(meter.input(input), meter.output(output));
|
||||
return meter;
|
||||
}
|
||||
|
||||
long inbound() { return inbound; }
|
||||
long outbound() { return outbound; }
|
||||
|
||||
private InputStream input(InputStream source) {
|
||||
return new InputStream() {
|
||||
@Override public int read() throws IOException {
|
||||
int value = source.read();
|
||||
if (value >= 0) inbound++;
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override public int read(byte[] buffer, int offset, int length) throws IOException {
|
||||
int count = source.read(buffer, offset, length);
|
||||
if (count > 0) inbound += count;
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override public long skip(long count) throws IOException {
|
||||
long skipped = source.skip(count);
|
||||
inbound += skipped;
|
||||
return skipped;
|
||||
}
|
||||
|
||||
@Override public int available() throws IOException { return source.available(); }
|
||||
@Override public void close() throws IOException { source.close(); }
|
||||
};
|
||||
}
|
||||
|
||||
private OutputStream output(OutputStream destination) {
|
||||
return new OutputStream() {
|
||||
@Override public void write(int value) throws IOException {
|
||||
destination.write(value);
|
||||
outbound++;
|
||||
}
|
||||
|
||||
@Override public void write(byte[] buffer, int offset, int length) throws IOException {
|
||||
destination.write(buffer, offset, length);
|
||||
outbound += length;
|
||||
}
|
||||
|
||||
@Override public void flush() throws IOException { destination.flush(); }
|
||||
@Override public void close() throws IOException { destination.close(); }
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package cloud.lunarsky.store;
|
||||
|
||||
final class Version {
|
||||
static final String VALUE = "0.1.0";
|
||||
static final String VALUE = "0.1.1";
|
||||
|
||||
private Version() {}
|
||||
}
|
||||
Reference in new issue
Block a user