-
Notifications
You must be signed in to change notification settings - Fork 2
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
29 changed files
with
787 additions
and
210 deletions.
There are no files selected for viewing
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
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,59 @@ | ||
// Copyright 2021-present Etherna SA | ||
// This file is part of Bee.Net. | ||
// | ||
// Bee.Net is free software: you can redistribute it and/or modify it under the terms of the | ||
// GNU Lesser General Public License as published by the Free Software Foundation, | ||
// either version 3 of the License, or (at your option) any later version. | ||
// | ||
// Bee.Net is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
// See the GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License along with Bee.Net. | ||
// If not, see <https://www.gnu.org/licenses/>. | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace Etherna.BeeNet.Models | ||
{ | ||
public interface IReadOnlyPostageBuckets | ||
{ | ||
// Properties. | ||
/// <summary> | ||
/// The higher level of collisions for a bucket | ||
/// </summary> | ||
uint MaxBucketCollisions { get; } | ||
|
||
/// <summary> | ||
/// The lower level of collisions for a bucket | ||
/// </summary> | ||
uint MinBucketCollisions { get; } | ||
|
||
/// <summary> | ||
/// Minimum required postage batch depth | ||
/// </summary> | ||
int RequiredPostageBatchDepth { get; } | ||
|
||
/// <summary> | ||
/// Total added chunks in buckets | ||
/// </summary> | ||
long TotalChunks { get; } | ||
|
||
// Methods. | ||
/// <summary> | ||
/// Amount of buckets, grouped by collisions | ||
/// </summary> | ||
/// <returns>Array with collisions as index, and buckets amount as values</returns> | ||
int[] CountBucketsByCollisions(); | ||
|
||
/// <summary> | ||
/// Get a copy of all buckets | ||
/// </summary> | ||
/// <returns>All the buckets</returns> | ||
uint[] GetBuckets(); | ||
|
||
IEnumerable<uint> GetBucketsByCollisions(uint collisions); | ||
|
||
uint GetCollisions(uint bucketId); | ||
} | ||
} |
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
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,9 @@ | ||
namespace Etherna.BeeNet.Models | ||
{ | ||
public class SwarmChunkReference(SwarmHash hash, XorEncryptKey? encryptionKey, bool useRecursiveEncryption) | ||
{ | ||
public XorEncryptKey? EncryptionKey { get; } = encryptionKey; | ||
public SwarmHash Hash { get; } = hash; | ||
public bool UseRecursiveEncryption { get; } = useRecursiveEncryption; | ||
} | ||
} |
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
Oops, something went wrong.