Skip to content

Commit

Permalink
feat: persisting address filters
Browse files Browse the repository at this point in the history
  • Loading branch information
richardschneider committed Jan 25, 2018
1 parent f037f6e commit 350e311
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/CoreApi/IBootstrapApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public interface IBootstrapApi
/// <summary>
/// List all the peers.
/// </summary>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// A task that represents the asynchronous operation. The task's result is
/// a sequence of addresses.
Expand Down
18 changes: 15 additions & 3 deletions src/CoreApi/ISwarmApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public interface ISwarmApi
/// An allowed address. For example "/ip4/104.131.131.82" or
/// "/ip4/192.168.0.0/ipcidr/16".
/// </param>
/// <param name="persist">
/// If <b>true</b> the filter will persist across daemon reboots.
/// </param>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
Expand All @@ -78,17 +81,23 @@ public interface ISwarmApi
/// the address filter that was added.
/// </returns>
/// <seealso href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing"/>
Task<MultiAddress> AddAddressFilterAsync(MultiAddress address, CancellationToken cancel = default(CancellationToken));
Task<MultiAddress> AddAddressFilterAsync(MultiAddress address, bool persist = false, CancellationToken cancel = default(CancellationToken));

/// <summary>
/// List all the address filters.
/// </summary>
/// <param name="persist">
/// If <b>true</b> only persisted filters are listed.
/// </param>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// A task that represents the asynchronous operation. The task's result is
/// a sequence of addresses filters.
/// </returns>
/// <seealso href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing"/>
Task<IEnumerable<MultiAddress>> ListAddressFiltersAsync(CancellationToken cancel = default(CancellationToken));
Task<IEnumerable<MultiAddress>> ListAddressFiltersAsync(bool persist = false, CancellationToken cancel = default(CancellationToken));

/// <summary>
/// Delete the specified address filter.
Expand All @@ -97,6 +106,9 @@ public interface ISwarmApi
/// For example "/ip4/104.131.131.82" or
/// "/ip4/192.168.0.0/ipcidr/16".
/// </param>
/// <param name="persist">
/// If <b>true</b> the filter is also removed from the persistent store.
/// </param>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
Expand All @@ -105,7 +117,7 @@ public interface ISwarmApi
/// the address filter that was removed.
/// </returns>
/// <seealso href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing"/>
Task<MultiAddress> RemoveAddressFilterAsync(MultiAddress address, CancellationToken cancel = default(CancellationToken));
Task<MultiAddress> RemoveAddressFilterAsync(MultiAddress address, bool persist = false, CancellationToken cancel = default(CancellationToken));

}
}

0 comments on commit 350e311

Please sign in to comment.