Implement Content Addressable Storage via CSI #15
I would rather we created an e2e test than lots of tiny unit tests; unit tests tend to ossify the implementation
Please don't use a regex for something which is trivial to write as go code.
Let's just use GRPC, rather than implementing our own protocol (assuming we can do that)
Impressive stuff. But let's create a separate CSI driver, not tied to agentfs. Let's create cas/ and put all our logic underneath it. If we create cas/.ap/ then ap should pick up on this as a "subproject".
We'll likely similarly move agentfs into its own subproject in future, but let's start with cas/
We might as well also compute and print the sha256 sum, to verify that we read it correctly!
Should we use /var/cache/cas instead?
Let's save to a temp file and rename (be careful to check for errors when calling close also, as that is a common mistake). Maybe create a helper function for this.
Not sure what this is for; can you please add a comment - this looks like either a pure hallucination or a clever GC trick
Let's verify that if there is an error it is IsNotExists
Let's just double-check that there is no existing casServer at targetPath
Let's warn if it does not exist, that's unexpected
Let's open the connection in NewClient, and reuse it until we Close() the Client
Can we not use GRPC?
Let's add a comment about why we're calling chdir, it's unobvious (IMO)
It's probably easier to try to Open it here and download if we get os.IsNotExist
Maybe we should normalize (convert to lower case) and return this as a type BlobID string just to represent that this is a validated and normalized blob id
Can we create a separate e2e test in tests/e2e? I'm OK with the code duplication around launching a cluster, we can tackle that later!
justinsb
codebot-robot
This PR implements Content Addressable Storage (CAS) support in the
in-cluster-storage(AgentFS) CSI driver.Solution Details:
pkg/cas): Implements a lightweight Unix Domain Socket server that binds to a well-known path inside the volume (.in-cluster-storage/api) and communicates with clients. It supports theGET <sha256>protocol to lookup blobs in a central host-level directory and pass an open file descriptor usingSCM_RIGHTS(ancillary control messages).NodePublishVolume(starting after mount) andNodeUnpublishVolume(safely stopping and cleaning up before unmount to avoidEBUSY).docs/research/cas.md.Fixes #14