Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ocm-lib introduction #367

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

fabianburth
Copy link
Contributor

What this PR does / why we need it:
It provides an introduction and overview of the ocm-lib to help other developers to get started.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Release Notes:

docs/lib/introduction.md Outdated Show resolved Hide resolved
docs/lib/introduction.md Outdated Show resolved Hide resolved
docs/lib/introduction.md Outdated Show resolved Hide resolved
docs/lib/introduction.md Outdated Show resolved Hide resolved
docs/lib/introduction.md Outdated Show resolved Hide resolved
docs/lib/introduction.md Outdated Show resolved Hide resolved
@fabianburth fabianburth marked this pull request as ready for review May 22, 2023 08:51
@achimweigel achimweigel requested a review from jensh007 May 22, 2023 08:59
@fabianburth fabianburth changed the title ocm-lib introduction (work in progress) ocm-lib introduction May 22, 2023
that has a corresponding _Type Registry_ is considered an extension point implementation (in the previous
examples, the _simplemessage package_ and the _complexmessage package_ are extension points as they
implement the _Message_ interface and there is a _Message Type Registry_).
**Settings:** On a conceptual level, settings are values that may be set for specific objects or passed to specific
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
**Settings:** On a conceptual level, settings are values that may be set for specific objects or passed to specific
**Settings:** Settings are values that may be set for specific objects or passed to specific

Again, within the ocm-lib, there are multiple implementations of this interface. But most importantly, the package
[`genericocireg`](../../pkg/contexts/ocm/repositories/genericocireg) provides an implementation of the _OCM Repository
interface_ that is based on the _OCI Repository interface_. In other words, this package provides a mapping of the
_OCM Repository_ functionility to the _OCI Repository_ functionality. The
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
_OCM Repository_ functionility to the _OCI Repository_ functionality. The
_OCM Repository_ functionality to the _OCI Repository_ functionality. The

Thus, as there is an **oci** _repository type_ `OCIRegistry`, there is also an **ocm** _repository type_ `OCIRegistry`,
as there is an **oci** _repository type_ `CommonTransportFormat`, there is also an **ocm** _repository type_
`CommonTransportFormat`.
Within the ocm-lib this is implemented through an **addition to the factory-based type registry** concept. In case the
Copy link
Member

Choose a reason for hiding this comment

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

I guess a word is missing here after "In case the ... "

(called `defaultdecoder`). For the OCM Repository Type Registry, this _fallback factory_ is usually
[initialized](../../pkg/contexts/ocm/builder.go) with a Type Registry itself, the
[`DefaultDelegationRegistry`](../../pkg/contexts/ocm/repositories/genericocireg/type.go) which is based on the
[`delegationRegistry`](../../pkg/contexts/ocm/internal/delegation.go). This Type Registry's iterates through all its
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
[`delegationRegistry`](../../pkg/contexts/ocm/internal/delegation.go). This Type Registry's iterates through all its
[`delegationRegistry`](../../pkg/contexts/ocm/internal/delegation.go). This Type Registry iterates through all its

[initialized](../../pkg/contexts/ocm/builder.go) with a Type Registry itself, the
[`DefaultDelegationRegistry`](../../pkg/contexts/ocm/repositories/genericocireg/type.go) which is based on the
[`delegationRegistry`](../../pkg/contexts/ocm/internal/delegation.go). This Type Registry's iterates through all its
factories and checks whether they knew that type. Currently, the only factory known by this _fallback Type Registry_ is
Copy link
Member

@In-Ko In-Ko May 22, 2023

Choose a reason for hiding this comment

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

Suggested change
factories and checks whether they knew that type. Currently, the only factory known by this _fallback Type Registry_ is
factories and checks whether one of them know that type. Currently, the only factory known by this _fallback Type Registry_ is


**Other Repository Types:**
Besides _OCM_ and _OCI Repository Types_, there currently also exist a number of
[_Credential Repository Types_](../../pkg/contexts/credentials/repositories) that have to implement the following
Copy link
Member

Choose a reason for hiding this comment

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

I don't quite get this: If these Credential Repo Types already exist, what is then meant with "that have to implement the following interface" ? If they do exist, wouldn't that mean they have already implemented the interface ?

a specific configuration for dealing with this _access type (= model type)_.

From the perspective of the ocm-lib, any _go type_ that implements the following
[interface](../../pkg/contexts/ocm/internal/accesstypes.go) can be considered an _OCI Repository_:
Copy link
Member

Choose a reason for hiding this comment

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

Why can the existence of a go type implementing this AccessMethod interface be considered a OCI repository ? Below, an implementation for S3 or GitHub are mentioned as examples, which is not an OCI repositories, so maybe rather "OCM Repository" is meant here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a copy-paste mistake. It should be ...can be considered an Access Method.

a triple of _RepositoryType_ (e.g. `OCIRegistry`, `CommonTransportFormat`, ...), _ArtifactType_ (e.g. `OCIArtifact`,
`ociImage`, ...) and _MimeType_ (e.g. `text/plain`, `application/gzip`, ...). The upload logic passes the current
contextual information about the underlying _storage repository type_ and the _artifact_ and _mime type_ at hand to the
_Lookup Handler_ method a _Constraint Registry_, which eventually returns a number of _Handlers_ fulfilling the
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
_Lookup Handler_ method a _Constraint Registry_, which eventually returns a number of _Handlers_ fulfilling the
_Lookup Handler_ method of a _Constraint Registry_, which eventually returns a number of _Handlers_ fulfilling the


### Section 3.3 - Constraint Registries aka. Handler Registries (and Handler-Registration Handler Registries)

**Constraint Registries aka. Handler Registries**
Copy link
Member

Choose a reason for hiding this comment

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

Why are these called CONSTRAINT Registries ? That term seems a bit unintuitive, no ?

}
```

Thus, a `HandlerRegistrationHandlerRegistry` also is itself also a `HandlerRegistrationHandler`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Thus, a `HandlerRegistrationHandlerRegistry` also is itself also a `HandlerRegistrationHandler`.
Thus, a `HandlerRegistrationHandlerRegistry` is itself also a `HandlerRegistrationHandler`.

`BlobHandlerRegistry` by calling the BlobHandlerRegistry's _Register_ method (e.g. in an
[init](../../pkg/contexts/ocm/blobhandler/oci/ocirepo/blobhandler.go) function to register that implementation in a
DefaultRegistry). Thereby, you have to pass an object of that handler implementation to the _Register_ method.
But imagine you are working with the _ocm-cli_ and you want to register either a predefined `BlobHandler` (in other
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
But imagine you are working with the _ocm-cli_ and you want to register either a predefined `BlobHandler` (in other
But imagine you are working with the _ocm-cli_ and you want to register a predefined `BlobHandler` (in other

`BlobHandlerRegistry` by calling the BlobHandlerRegistry's _Register_ method (e.g. in an
[init](../../pkg/contexts/ocm/blobhandler/oci/ocirepo/blobhandler.go) function to register that implementation in a
DefaultRegistry). Thereby, you have to pass an object of that handler implementation to the _Register_ method.
But imagine you are working with the _ocm-cli_ and you want to register either a predefined `BlobHandler` (in other
Copy link
Member

Choose a reason for hiding this comment

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

What would be a usecase for registering such a predefined Handler ? Why is this a necessary feature to have , making things rather complex ? I would like to see some real-world example here, which could really help to motivate the reader to understand this complex stuff ...

}
```

A `RepositorySpecHandlers` Registry **is not** also a `HandlerRegistrationHandlerRegistry`.
Copy link
Member

Choose a reason for hiding this comment

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

Why is it necessary to state this so explicitly here ? And if it is necessary, some reasoning why this is not the case should be provided.

These decisions can be made within BlobHandlers. The `StoreBlob` method has to return an `AccessSpec` that can then be
inserted into the corresponding new _Component Descriptor_.

A `BlobHanderRegistry` **is** also a `HandlerRegistrationHandlerRegistry`.
Copy link
Member

Choose a reason for hiding this comment

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

Same as above: If it is necessary to state this here so explicitly, then some reasoning would be nice.

Here, the different _Contexts_ shown in the overview are explained.

A context object is the _entry point_ for using dedicated functional areas. It bundles all _settings_ and
_extensions point implementations_ for this area.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
_extensions point implementations_ for this area.
_extension point implementations_ for this area.

@morri-son
Copy link
Contributor

@fabianburth @mandelsoft What should happen with this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create OCM Library developer documentation
3 participants