Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
453 changes: 453 additions & 0 deletions src/OrasProject.Oras/Content/File/Store.cs

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions src/OrasProject.Oras/Exceptions/DuplicateNameException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright The ORAS Authors.
// 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.

using System;

namespace OrasProject.Oras.Exceptions;

/// <summary>
/// Exception thrown when a duplicate name is encountered.
/// </summary>
public class DuplicateNameException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="DuplicateNameException"/> class.
/// </summary>
public DuplicateNameException() : base("duplicate name")
{
}

/// <summary>
/// Initializes a new instance of the <see cref="DuplicateNameException"/> class with a specified error message.
/// </summary>
/// <param name="message">The message that describes the error.</param>
public DuplicateNameException(string? message) : base(message)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="DuplicateNameException"/> class with a specified error message
/// and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
/// <param name="innerException">The exception that is the cause of the current exception.</param>
public DuplicateNameException(string? message, Exception? innerException) : base(message, innerException)
{
}
}
47 changes: 47 additions & 0 deletions src/OrasProject.Oras/Exceptions/MissingNameException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright The ORAS Authors.
// 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.

using System;

namespace OrasProject.Oras.Exceptions;

/// <summary>
/// Exception thrown when a required name is missing.
/// </summary>
public class MissingNameException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="MissingNameException"/> class.
/// </summary>
public MissingNameException() : base("missing name")
{
}

/// <summary>
/// Initializes a new instance of the <see cref="MissingNameException"/> class with a specified error message.
/// </summary>
/// <param name="message">The message that describes the error.</param>
public MissingNameException(string? message) : base(message)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="MissingNameException"/> class with a specified error message
/// and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
/// <param name="innerException">The exception that is the cause of the current exception.</param>
public MissingNameException(string? message, Exception? innerException) : base(message, innerException)
{
}
}
34 changes: 34 additions & 0 deletions src/OrasProject.Oras/Exceptions/MissingReferenceException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright The ORAS Authors.
// 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.

using System;

namespace OrasProject.Oras.Exceptions;

/// <summary>
/// Exception thrown when a required reference is missing.
/// </summary>
public class MissingReferenceException : Exception
{
public MissingReferenceException() : base("missing reference")
{
}

public MissingReferenceException(string? message) : base(message)
{
}

Comment thread
wangxiaoxuan273 marked this conversation as resolved.
public MissingReferenceException(string? message, Exception? innerException) : base(message, innerException)
{
}
}
Comment thread
wangxiaoxuan273 marked this conversation as resolved.
34 changes: 34 additions & 0 deletions src/OrasProject.Oras/Exceptions/StoreClosedException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright The ORAS Authors.
// 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.

using System;

namespace OrasProject.Oras.Exceptions;

/// <summary>
/// Exception thrown when an operation is attempted on a closed store.
/// </summary>
public class StoreClosedException : Exception
{
public StoreClosedException() : base("store already closed")
{
}

public StoreClosedException(string? message) : base(message)
{
}

Comment thread
wangxiaoxuan273 marked this conversation as resolved.
public StoreClosedException(string? message, Exception? innerException) : base(message, innerException)
{
}
}
Comment thread
wangxiaoxuan273 marked this conversation as resolved.
6 changes: 6 additions & 0 deletions src/OrasProject.Oras/Oci/Descriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ public class Descriptor
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string? ArtifactType { get; set; }

/// <summary>
/// AnnotationTitle is the annotation key for the human-readable title of the image.
/// Specification: https://github.com/opencontainers/image-spec/blob/v1.1.0/annotations.md#pre-defined-annotation-keys
Comment thread
wangxiaoxuan273 marked this conversation as resolved.
/// </summary>
public const string AnnotationTitle = "org.opencontainers.image.title";

public static Descriptor Create(Span<byte> data, string mediaType)
{
byte[] byteData = data.ToArray();
Expand Down
Loading
Loading