Skip to content
Draft
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
12 changes: 9 additions & 3 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
branches:
- dev
- future
- rc/*
tags:
- v[0-9]+.[0-9]+.[0-9]+ # Matches all semantic versioning tags with major, minor, patch
pull_request:
Expand All @@ -22,6 +23,10 @@ env:
MORYX_PACKAGE_TARGET_V3_FUTURE: 'https://www.myget.org/F/moryx-oss-ci/api/v3/index.json'
MORYX_PACKAGE_TARGET_RELEASE: 'https://api.nuget.org/v3/index.json'
MORYX_PACKAGE_TARGET_V3_RELEASE: 'https://api.nuget.org/v3/index.json'
REF_NAME: ${{ github.ref_name}}
BASE_REF: ${{ github.base_ref}}
REF: ${{ github.ref }}
HEAD_REF: ${{ github.head_ref }}

jobs:
EnvVar:
Expand All @@ -30,17 +35,18 @@ jobs:
- run: echo ""
outputs:
dotnet_sdk_version: ${{ env.dotnet_sdk_version }}
REPOSITORY_NAME: ${{ env.REPOSITORY_NAME }}
REPOSITORY_NAME: ${{ github.event.repository.name }}
MORYX_PACKAGE_TARGET_DEV: ${{ env.MORYX_PACKAGE_TARGET_DEV }}
MORYX_PACKAGE_TARGET_V3_DEV: ${{ env.MORYX_PACKAGE_TARGET_V3_DEV }}
MORYX_PACKAGE_TARGET_FUTURE: ${{ env.MORYX_PACKAGE_TARGET_FUTURE }}
MORYX_PACKAGE_TARGET_V3_FUTURE: ${{ env.MORYX_PACKAGE_TARGET_V3_FUTURE }}
MORYX_PACKAGE_TARGET_RELEASE: ${{ env.MORYX_PACKAGE_TARGET_RELEASE }}
MORYX_PACKAGE_TARGET_V3_RELEASE: ${{ env.MORYX_PACKAGE_TARGET_V3_RELEASE }}


Build:
needs: [EnvVar]
uses: phoenixcontact/tools/.github/workflows/build-tool.yml@main
uses: phoenixcontact/tools/.github/workflows/build-tool.yml@rc-builds
with:
dotnet_sdk_version: ${{ needs.EnvVar.outputs.dotnet_sdk_version }}
REPOSITORY_NAME: ${{ needs.EnvVar.outputs.REPOSITORY_NAME }}
Expand Down Expand Up @@ -83,7 +89,7 @@ jobs:

Publish:
needs: [EnvVar, UnitTests]
uses: phoenixcontact/tools/.github/workflows/publish-tool.yml@main
uses: phoenixcontact/tools/.github/workflows/publish-tool.yml@rc-builds
with:
dotnet_sdk_version: ${{ needs.EnvVar.outputs.dotnet_sdk_version }}
REPOSITORY_NAME: ${{ needs.EnvVar.outputs.REPOSITORY_NAME }}
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.4.2
8.5.0
28 changes: 28 additions & 0 deletions docs/articles/Core/FileSystem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
uid: FileSystem
---
# FileSystem

## Inspiration

The MORYX file system was inspired by the GIT tree and obj structure.

## Architecture

````mermaid
classDiagram
MoryxFile <|-- Blob
MoryxFile <|-- Tree
Tree --> MoryxFile
OwnerFile --> Tree
class MoryxFileSystem{
-string Directory
+WriteBlob()
+WriteTree()
+ReadBlob()
+ReadTree()
}
class MoryxFile {
+String Hash
}
````
62 changes: 62 additions & 0 deletions src/Moryx.Runtime.Kernel/FileSystem/HashPath.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using Microsoft.Extensions.Logging;
using Moryx.Logging;
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace Moryx.Runtime.Kernel.FileSystem
{
internal class HashPath
{
public string Hash { get; private set; }

public string DirectoryName { get; private set; }

public string FileName { get; private set; }

private HashPath()
{
}

public static HashPath FromStream(Stream stream) =>
BuildPath(HashFromStream(stream));

public static HashPath FromHash(string hash) =>
BuildPath(hash);

public string FilePath(string storagePath) =>
Path.Combine(storagePath, DirectoryName, FileName);

public string DirectoryPath(string storagePath) =>
Path.Combine(storagePath, DirectoryName);

private static HashPath BuildPath(string hash)
{
return new HashPath
{
Hash = hash,
DirectoryName = hash.Substring(0, 2),
FileName = hash.Substring(2)
};
}

private static string HashFromStream(Stream stream)
{
string name;
using (var hashing = SHA256.Create())
{
stream.Position = 0;

var hash = hashing.ComputeHash(stream);
name = BitConverter.ToString(hash).Replace("-", string.Empty);

stream.Position = 0;
}

return name;
}
}
}
Loading
Loading