From 63571a45e3b4b20fe5d7e5588cf2094d415aa9c1 Mon Sep 17 00:00:00 2001 From: Nick Lanham Date: Fri, 11 Oct 2024 13:05:56 -0700 Subject: [PATCH] add big comment --- kernel/src/engine/default/mod.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/kernel/src/engine/default/mod.rs b/kernel/src/engine/default/mod.rs index 77eae7025..576e09acf 100644 --- a/kernel/src/engine/default/mod.rs +++ b/kernel/src/engine/default/mod.rs @@ -55,7 +55,25 @@ impl DefaultEngine { } pub fn new(store: Arc, prefix: Path, task_executor: Arc) -> Self { - // HACK to check if we're using a LocalFileSystem from ObjectStore + // HACK to check if we're using a LocalFileSystem from ObjectStore. We need this because + // local filesystem doesn't return a sorted list by default. Although the `object_store` + // crate explicitly says it _does not_ return a sorted listing, in practice all the cloud + // implementations actually do: + // - AWS: + // [`ListObjectsV2`](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html) + // states: "For general purpose buckets, ListObjectsV2 returns objects in lexicographical + // order based on their key names." (Directory buckets are out of scope for now) + // - Azure: Docs state + // [here](https://learn.microsoft.com/en-us/rest/api/storageservices/enumerating-blob-resources): + // "A listing operation returns an XML response that contains all or part of the requested + // list. The operation returns entities in alphabetical order." + // - GCP: The [main](https://cloud.google.com/storage/docs/xml-api/get-bucket-list) doc + // doesn't indicate order, but [this + // page](https://cloud.google.com/storage/docs/xml-api/get-bucket-list) does say: "This page + // shows you how to list the [objects](https://cloud.google.com/storage/docs/objects) stored + // in your Cloud Storage buckets, which are ordered in the list lexicographically by name." + // So we just need to know if we're local and then if so, we sort the returned file list in + // `filesystem.rs` let store_str = format!("{}", store); let is_local = store_str.starts_with("LocalFileSystem"); Self {