Skip to content

feat: direct blob#503

Merged
jakobmoellerdev merged 7 commits into
open-component-model:mainfrom
jakobmoellerdev:direct-blob
Aug 8, 2025
Merged

feat: direct blob#503
jakobmoellerdev merged 7 commits into
open-component-model:mainfrom
jakobmoellerdev:direct-blob

Conversation

@jakobmoellerdev

@jakobmoellerdev jakobmoellerdev commented Aug 5, 2025

Copy link
Copy Markdown
Member

What this PR does / why we need it

this implements a direct blob, a blob that can be read from many times independently but that does not buffer itself backed by io.Reader

this is especially useful when forwarding already existing buffers such as bytes.Buffer or plain []byte slices, or using readers created by strings.NewReader or bytes.NewReader. All of these implementations are fully compatible with this implementation. Even using an os file descriptors or http responses directly is valid.

Which issue(s) this PR fixes

One caveat towards the existing "inmemory" implementation is that because it does not buffer data itself, we cannot know the digest in advance and if someone wants to compute it, they will have to buffer the data themselves and compute it dynamically. The obvious upside though is that we can write blob providers that do not implicitly cache data on the source, but rather get cached on demand.

part of open-component-model/ocm-project#580

this implements a direct blob, aka a blob that can be read from many times independently but that does not buffer itself.

this is especially useful when forwarding already existing buffers such as bytes.Buffer or plain []byte slices.

One caveat towards the existing "inmemory" implementation is that because it does not buffer itself, we cannot know the digest and if someone wants to compute it, they will have to buffer the data themselves and compute it dynamically.

Signed-off-by: Jakob Möller <jakob.moeller@sap.com>
@jakobmoellerdev jakobmoellerdev requested a review from a team as a code owner August 5, 2025 16:46
@github-actions github-actions Bot added kind/feature new feature, enhancement, improvement, extension size/l Large labels Aug 5, 2025
this implements a direct blob, aka a blob that can be read from many times independently but that does not buffer itself.

this is especially useful when forwarding already existing buffers such as bytes.Buffer or plain []byte slices.

One caveat towards the existing "inmemory" implementation is that because it does not buffer itself, we cannot know the digest and if someone wants to compute it, they will have to buffer the data themselves and compute it dynamically.

Signed-off-by: Jakob Möller <jakob.moeller@sap.com>

@Skarlso Skarlso left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a couple of questions... hopefully they aren't that much of a trouble. :D

Comment thread bindings/go/blob/direct/blob.go
Comment thread bindings/go/blob/direct/blob.go Outdated
Comment thread bindings/go/blob/direct/blob.go
Comment thread bindings/go/blob/direct/options.go
Signed-off-by: Jakob Möller <jakob.moeller@sap.com>
Skarlso
Skarlso previously approved these changes Aug 7, 2025
@jakobmoellerdev jakobmoellerdev enabled auto-merge (squash) August 7, 2025 15:55
Signed-off-by: Jakob Möller <jakob.moeller@sap.com>
@jakobmoellerdev

Copy link
Copy Markdown
Member Author

forgot to rollback the README, just updated that now

@jakobmoellerdev jakobmoellerdev enabled auto-merge (squash) August 8, 2025 09:16
@jakobmoellerdev jakobmoellerdev merged commit 0ed6cff into open-component-model:main Aug 8, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature new feature, enhancement, improvement, extension size/l Large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants