-
-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
128 additions
and
4 deletions.
There are no files selected for viewing
Empty file.
7 changes: 7 additions & 0 deletions
7
reposilite-backend/src/main/kotlin/com/reposilite/packages/PackageRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.reposilite.packages | ||
|
||
|
||
interface PackageRepository { | ||
|
||
|
||
} |
4 changes: 0 additions & 4 deletions
4
reposilite-backend/src/main/kotlin/com/reposilite/packages/Repository.kt
This file was deleted.
Oops, something went wrong.
Empty file.
43 changes: 43 additions & 0 deletions
43
reposilite-backend/src/main/kotlin/com/reposilite/packages/oci/OciFacade.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2023 dzikoysk | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.reposilite.packages.oci | ||
|
||
import com.reposilite.journalist.Journalist | ||
import com.reposilite.journalist.Logger | ||
import com.reposilite.packages.oci.api.ManifestResponse | ||
import com.reposilite.packages.oci.api.SaveManifestRequest | ||
import com.reposilite.plugin.api.Facade | ||
import com.reposilite.shared.ErrorResponse | ||
import com.reposilite.storage.StorageProvider | ||
import com.reposilite.storage.api.toLocation | ||
import panda.std.Result | ||
import panda.std.asSuccess | ||
|
||
class OciFacade( | ||
private val journalist: Journalist, | ||
private val storageProvider: StorageProvider | ||
) : Journalist, Facade { | ||
|
||
fun saveManifest(saveManifestRequest: SaveManifestRequest): Result<ManifestResponse, ErrorResponse> { | ||
storageProvider.putFile("oci/manifest.json".toLocation(), saveManifestRequest.toString().toByteArray().inputStream()) | ||
return saveManifestRequest.let { ManifestResponse(it.schemaVersion, it.mediaType, it.config, it.layers) }.asSuccess() | ||
} | ||
|
||
override fun getLogger(): Logger = | ||
journalist.logger | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
reposilite-backend/src/main/kotlin/com/reposilite/packages/oci/api/ManifestApi.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2023 dzikoysk | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.reposilite.packages.oci.api | ||
|
||
data class SaveManifestRequest( | ||
val schemaVersion: Int, | ||
val mediaType: String, | ||
val config: ManifestConfig, | ||
val layers: List<ManifestLayer>, | ||
) | ||
|
||
data class ManifestResponse( | ||
val schemaVersion: Int, | ||
val mediaType: String, | ||
val config: ManifestConfig, | ||
val layers: List<ManifestLayer>, | ||
) | ||
|
||
data class ManifestConfig( | ||
val mediaType: String, | ||
val size: Int, | ||
val digest: String, | ||
) | ||
|
||
data class ManifestLayer( | ||
val mediaType: String, | ||
val size: Int, | ||
val digest: String, | ||
) |
35 changes: 35 additions & 0 deletions
35
reposilite-backend/src/main/kotlin/com/reposilite/packages/oci/application/OciPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (c) 2023 dzikoysk | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.reposilite.packages.oci.application | ||
|
||
import com.reposilite.packages.oci.OciFacade | ||
import com.reposilite.plugin.api.Plugin | ||
import com.reposilite.plugin.api.ReposilitePlugin | ||
|
||
@Plugin( | ||
name = "oci", | ||
dependencies = ["failure", "local-configuration", "shared-configuration", "statistics", "authentication", "access-token", "storage"] | ||
) | ||
internal class OciPlugin : ReposilitePlugin() { | ||
|
||
override fun initialize(): OciFacade { | ||
val ociFacade = OciFacade(this) | ||
|
||
return ociFacade | ||
} | ||
|
||
} |