Skip to content

Commit

Permalink
Merge pull request #67 from Etherna/improve/BNET-132-bee-230
Browse files Browse the repository at this point in the history
Improve/bnet 132 bee 230
  • Loading branch information
tmm360 authored Dec 4, 2024
2 parents 04ec1d1 + 0fd7935 commit a9f34e7
Show file tree
Hide file tree
Showing 10 changed files with 2,017 additions and 1,056 deletions.
176 changes: 121 additions & 55 deletions src/BeeNet.Client/BeeClient.cs

Large diffs are not rendered by default.

2,188 changes: 1,392 additions & 796 deletions src/BeeNet.Client/Clients/BeeGeneratedClient.cs

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions src/BeeNet.Core/Models/NeighborhoodStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 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/>.

namespace Etherna.BeeNet.Models
{
public sealed class NeighborhoodStatus(
string neighborhood,
int proximity,
int reserveSizeWithinRadius)
{
public string Neighborhood { get; } = neighborhood;
public int Proximity { get; } = proximity;
public int ReserveSizeWithinRadius { get; } = reserveSizeWithinRadius;
}
}
6 changes: 4 additions & 2 deletions src/BeeNet.Core/Models/ReserveCommitment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@
// 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;

namespace Etherna.BeeNet.Models
{
public sealed class ReserveCommitment(
int duration,
TimeSpan duration,
SwarmHash hash,
ReserveCommitmentProof proof1,
ReserveCommitmentProof proof2,
ReserveCommitmentProof proofLast)
{
// Properties.
public int Duration { get; } = duration;
public TimeSpan Duration { get; } = duration;
public SwarmHash Hash { get; } = hash;
public ReserveCommitmentProof Proof1 { get; } = proof1;
public ReserveCommitmentProof Proof2 { get; } = proof2;
Expand Down
2 changes: 2 additions & 0 deletions src/BeeNet.Core/Models/StatusNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace Etherna.BeeNet.Models
public sealed class StatusNode(
StatusBeeMode beeMode,
int batchCommitment,
int committedDepth,
int connectedPeers,
bool isReachable,
long lastSyncedBlock,
Expand All @@ -32,6 +33,7 @@ public sealed class StatusNode(
// Properties.
public StatusBeeMode BeeMode { get; } = beeMode;
public int BatchCommitment { get; } = batchCommitment;
public int CommittedDepth { get; } = committedDepth;
public int ConnectedPeers { get; } = connectedPeers;
public bool IsReachable { get; } = isReachable;
public long LastSyncedBlock { get; } = lastSyncedBlock;
Expand Down
29 changes: 25 additions & 4 deletions src/BeeNet.Util/IBeeClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ Task<BzzBalance> GetBalanceWithPeerAsync(
Task<Stream> GetBytesAsync(
SwarmHash hash,
bool? swarmCache = null,
RedundancyLevel? swarmRedundancyLevel = null,
RedundancyStrategy? swarmRedundancyStrategy = null,
bool? swarmRedundancyFallbackMode = null,
string? swarmChunkRetrievalTimeout = null,
Expand Down Expand Up @@ -375,12 +376,17 @@ Task<BzzBalance> GetConsumedBalanceWithPeerAsync(
/// <param name="type">Feed indexing scheme (default: sequence)</param>
/// <returns>Latest feed update</returns>
/// <exception cref="BeeNetGatewayApiException">A server side error occurred.</exception>
Task<SwarmHash> GetFeedAsync(
Task<FileResponse> GetFeedAsync(
string owner,
string topic,
int? at = null,
int? after = null,
string? type = null,
bool? swarmOnlyRootChunk = null,
bool? swarmCache = null,
RedundancyStrategy? swarmRedundancyStrategy = null,
bool? swarmRedundancyFallbackMode = null,
string? swarmChunkRetrievalTimeout = null,
CancellationToken cancellationToken = default);

/// <summary>Get file or index document from a collection of files</summary>
Expand All @@ -394,6 +400,7 @@ Task<SwarmHash> GetFeedAsync(
Task<FileResponse> GetFileAsync(
SwarmAddress address,
bool? swarmCache = null,
RedundancyLevel? swarmRedundancyLevel = null,
RedundancyStrategy? swarmRedundancyStrategy = null,
bool? swarmRedundancyFallbackMode = null,
string? swarmChunkRetrievalTimeout = null,
Expand All @@ -407,6 +414,9 @@ Task<FileResponse> GetFileAsync(
/// <exception cref="BeeNetGatewayApiException">A server side error occurred.</exception>
Task<Health> GetHealthAsync(CancellationToken cancellationToken = default);

Task<IEnumerable<NeighborhoodStatus>> GetNeighborhoodsStatus(
CancellationToken cancellationToken = default);

/// <summary>
/// Get information about the node
/// </summary>
Expand Down Expand Up @@ -469,6 +479,16 @@ Task<SettlementData> GetSettlementsWithPeerAsync(
string peerAddress,
CancellationToken cancellationToken = default);

Task<FileResponse> GetSocDataAsync(
string owner,
string id,
bool? swarmOnlyRootChunk = null,
bool? swarmCache = null,
RedundancyStrategy? swarmRedundancyStrategy = null,
bool? swarmRedundancyFallbackMode = null,
string? swarmChunkRetrievalTimeout = null,
CancellationToken cancellationToken = default);

/// <summary>Get extended bucket data of a batch</summary>
/// <param name="batchId">Swarm address of the stamp</param>
/// <returns>Returns extended bucket data of the provided batch ID</returns>
Expand Down Expand Up @@ -725,6 +745,10 @@ Task StakePostAsync(
/// <returns>Returns the status snapshot of this node connected peers</returns>
Task<IEnumerable<StatusNode>> StatusPeersAsync(CancellationToken cancellationToken = default);

Task SubscribeToGsocAsync(
string reference,
CancellationToken cancellationToken = default);

/// <summary>Subscribe for messages on the given topic.</summary>
/// <param name="topic">Topic name</param>
/// <returns>Returns a WebSocket with a subscription for incoming message data on the requested topic.</returns>
Expand Down Expand Up @@ -911,8 +935,6 @@ Task<SwarmHash> UploadFileAsync(
/// <param name="sig">Signature</param>
/// <param name="batchId"></param>
/// <param name="body">The SOC binary data is composed of the span (8 bytes) and the at most 4KB payload.</param>
/// <param name="swarmPin">Represents if the uploaded data should be also locally pinned on the node.
/// <br/>Warning! Not available for nodes that run in Gateway mode!</param>
/// <returns>Reference hash</returns>
/// <exception cref="BeeNetGatewayApiException">A server side error occurred.</exception>
Task<SwarmHash> UploadSocAsync(
Expand All @@ -921,7 +943,6 @@ Task<SwarmHash> UploadSocAsync(
string sig,
PostageBatchId batchId,
Stream body,
bool? swarmPin = null,
string? swarmPostageStamp = null,
bool? swarmAct = null,
string? swarmActHistoryAddress = null,
Expand Down
Loading

0 comments on commit a9f34e7

Please sign in to comment.