Skip to content

Commit

Permalink
Merge pull request #4 from Arlodotexe/rel/0.8.0
Browse files Browse the repository at this point in the history
Release 0.8.0. New interfaces, added WritableLazySeekStream.
  • Loading branch information
Arlodotexe authored Apr 27, 2024
2 parents 808ad0d + fba999b commit d9292c3
Show file tree
Hide file tree
Showing 12 changed files with 252 additions and 109 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Install .NET 6 SDK
- name: Install .NET 8 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.201'
dotnet-version: '8.0.201'

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand Down
16 changes: 16 additions & 0 deletions src/IFlushable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Threading;
using System.Threading.Tasks;

namespace OwlCore.ComponentModel;

/// <summary>
/// Represents a resource that can be flushed from memory to an underlying source.
/// </summary>
public interface IFlushable
{
/// <summary>
/// Flushes the resource to the underlying device.
/// </summary>
/// <param name="cancellationToken">A token that can be used to cancel the ongoing operation.</param>
Task FlushAsync(CancellationToken cancellationToken);
}
12 changes: 12 additions & 0 deletions src/IHasId.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace OwlCore.ComponentModel;

/// <summary>
/// Represents an object with a unique instance Id. This Id should be identical across runs and environments.
/// </summary>
public interface IHasId
{
/// <summary>
/// An Id corresponding to this object instance. This Id should be unique for the object, but identical across runs and environments.
/// </summary>
string Id { get; init; }
}
15 changes: 15 additions & 0 deletions src/IReadOnlySources.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Collections.Generic;

namespace OwlCore.ComponentModel;

/// <summary>
/// Indicates an object that has a list of sources that cannot be modified.
/// </summary>
/// <typeparam name="T">The inner collection type.</typeparam>
public interface IReadOnlySources<T>
{
/// <summary>
/// The sources for this event stream. Each contains timestamped event data from all participating nodes.
/// </summary>
IReadOnlyCollection<T> Sources { get; init; }
}
103 changes: 51 additions & 52 deletions src/ISerializer.cs
Original file line number Diff line number Diff line change
@@ -1,65 +1,64 @@
using System;

namespace OwlCore.ComponentModel
namespace OwlCore.ComponentModel;

/// <summary>
/// An interface that allows serializing data to and from <typeparamref name="TSerialized"/> synchronously.
/// </summary>
/// <typeparam name="TSerialized">The type that data is serialized to.</typeparam>
public interface ISerializer<TSerialized>
{
/// <summary>
/// An interface that allows serializing data to and from <typeparamref name="TSerialized"/> synchronously.
/// Serializes the provided <paramref name="data"/> into <typeparamref name="TSerialized"/>.
/// </summary>
/// <typeparam name="TSerialized">The type that data is serialized to.</typeparam>
public interface ISerializer<TSerialized>
{
/// <summary>
/// Serializes the provided <paramref name="data"/> into <typeparamref name="TSerialized"/>.
/// </summary>
/// <param name="data">The object instance to serialize.</param>
/// <typeparam name="T">The type of the object being serialized.</typeparam>
/// <returns>A serialized instance of <paramref name="data"/>.</returns>
public TSerialized Serialize<T>(T data);
/// <param name="data">The object instance to serialize.</param>
/// <typeparam name="T">The type of the object being serialized.</typeparam>
/// <returns>A serialized instance of <paramref name="data"/>.</returns>
TSerialized Serialize<T>(T data);

/// <summary>
/// Serializes the provided <paramref name="data"/> into <typeparamref name="TSerialized"/>.
/// </summary>
/// <param name="data">The object instance to serialize.</param>
/// <param name="type">The type of the object being serialized.</param>
/// <returns>A serialized instance of <paramref name="data"/>.</returns>
public TSerialized Serialize(Type type, object data);
/// <summary>
/// Serializes the provided <paramref name="data"/> into <typeparamref name="TSerialized"/>.
/// </summary>
/// <param name="data">The object instance to serialize.</param>
/// <param name="type">The type of the object being serialized.</param>
/// <returns>A serialized instance of <paramref name="data"/>.</returns>
TSerialized Serialize(Type type, object data);

/// <summary>
/// Deserializes the provided <paramref name="serialized"/> data into the given type.
/// </summary>
/// <param name="serialized">A serialized instance to deserialize.</param>
/// <typeparam name="TResult">The type to deserialize to.</typeparam>
/// <returns>A deserialized instance of the provided serialized data.</returns>
public TResult Deserialize<TResult>(TSerialized serialized);
/// <summary>
/// Deserializes the provided <paramref name="serialized"/> data into the given type.
/// </summary>
/// <param name="serialized">A serialized instance to deserialize.</param>
/// <typeparam name="TResult">The type to deserialize to.</typeparam>
/// <returns>A deserialized instance of the provided serialized data.</returns>
TResult Deserialize<TResult>(TSerialized serialized);

/// <summary>
/// Deserializes the provided <paramref name="serialized"/> data into the given type.
/// </summary>
/// <param name="serialized">A serialized instance to deserialize.</param>
/// <param name="type">The type of the object being serialized.</param>
/// <returns>A deserialized instance of the provided serialized data.</returns>
public object Deserialize(Type type, TSerialized serialized);
}
/// <summary>
/// Deserializes the provided <paramref name="serialized"/> data into the given type.
/// </summary>
/// <param name="serialized">A serialized instance to deserialize.</param>
/// <param name="type">The type of the object being serialized.</param>
/// <returns>A deserialized instance of the provided serialized data.</returns>
object Deserialize(Type type, TSerialized serialized);
}

/// <summary>
/// An interface that allows serializing data to <typeparamref name="TDeserialized"/> and from <typeparamref name="TSerialized"/> synchronously.
/// </summary>
/// <typeparam name="TSerialized">The type that data is serialized to.</typeparam>
/// <typeparam name="TDeserialized">The type that data is deserialized to.</typeparam>
public interface ISerializer<TSerialized, TDeserialized>
{
/// <summary>
/// An interface that allows serializing data to <typeparamref name="TDeserialized"/> and from <typeparamref name="TSerialized"/> synchronously.
/// Serializes the provided <paramref name="data"/> into <typeparamref name="TSerialized"/>.
/// </summary>
/// <typeparam name="TSerialized">The type that data is serialized to.</typeparam>
/// <typeparam name="TDeserialized">The type that data is deserialized to.</typeparam>
public interface ISerializer<TSerialized, TDeserialized>
{
/// <summary>
/// Serializes the provided <paramref name="data"/> into <typeparamref name="TSerialized"/>.
/// </summary>
/// <param name="data">The object instance to serialize.</param>
/// <returns>A serialized instance of <paramref name="data"/>.</returns>
public TSerialized Serialize(TDeserialized data);
/// <param name="data">The object instance to serialize.</param>
/// <returns>A serialized instance of <paramref name="data"/>.</returns>
TSerialized Serialize(TDeserialized data);

/// <summary>
/// Deserializes the provided <paramref name="serialized"/> data into the given type.
/// </summary>
/// <param name="serialized">A serialized instance to deserialize.</param>
/// <returns>A deserialized instance of the provided serialized data.</returns>
public TDeserialized Deserialize(TSerialized serialized);
}
/// <summary>
/// Deserializes the provided <paramref name="serialized"/> data into the given type.
/// </summary>
/// <param name="serialized">A serialized instance to deserialize.</param>
/// <returns>A deserialized instance of the provided serialized data.</returns>
TDeserialized Deserialize(TSerialized serialized);
}
15 changes: 15 additions & 0 deletions src/ISources.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Collections.Generic;

namespace OwlCore.ComponentModel;

/// <summary>
/// Indicates an object that has a reference to a list of sources that can be changed.
/// </summary>
/// <typeparam name="T">The inner collection type.</typeparam>
public interface ISources<T>
{
/// <summary>
/// The sources for this event stream. Each contains timestamped event data from all participating nodes.
/// </summary>
ICollection<T> Sources { get; init; }
}
16 changes: 0 additions & 16 deletions src/IsExternalInit.cs

This file was deleted.

Loading

0 comments on commit d9292c3

Please sign in to comment.