-
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
1 parent
8013708
commit 1db4ada
Showing
17 changed files
with
555 additions
and
23 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
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
File renamed without changes.
8 changes: 8 additions & 0 deletions
8
....Orleans.RateLimiting.Tests/Cluster/Grains/Interfaces/ITestFixedWindowRateLimiterGrain.cs
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,8 @@ | ||
namespace ManagedCode.Orleans.RateLimiting.Tests.Cluster.Grains.Interfaces; | ||
|
||
public interface ITestFixedWindowRateLimiterGrain : IGrainWithStringKey | ||
{ | ||
Task<string> Do(); | ||
Task<string> Go(); | ||
Task<string> Take(); | ||
} |
8 changes: 8 additions & 0 deletions
8
...rleans.RateLimiting.Tests/Cluster/Grains/Interfaces/ITestSlidingWindowRateLimiterGrain.cs
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,8 @@ | ||
namespace ManagedCode.Orleans.RateLimiting.Tests.Cluster.Grains.Interfaces; | ||
|
||
public interface ITestSlidingWindowRateLimiterGrain : IGrainWithStringKey | ||
{ | ||
Task<string> Do(); | ||
Task<string> Go(); | ||
Task<string> Take(); | ||
} |
8 changes: 8 additions & 0 deletions
8
....Orleans.RateLimiting.Tests/Cluster/Grains/Interfaces/ITestTokenBucketRateLimiterGrain.cs
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,8 @@ | ||
namespace ManagedCode.Orleans.RateLimiting.Tests.Cluster.Grains.Interfaces; | ||
|
||
public interface ITestTokenBucketRateLimiterGrain : IGrainWithStringKey | ||
{ | ||
Task<string> Do(); | ||
Task<string> Go(); | ||
Task<string> Take(); | ||
} |
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
28 changes: 28 additions & 0 deletions
28
ManagedCode.Orleans.RateLimiting.Tests/Cluster/Grains/TestFixedWindowRateLimiterGrain.cs
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,28 @@ | ||
using ManagedCode.Orleans.RateLimiting.Core.Attributes; | ||
using ManagedCode.Orleans.RateLimiting.Tests.Cluster.Grains.Interfaces; | ||
|
||
namespace ManagedCode.Orleans.RateLimiting.Tests.Cluster.Grains; | ||
|
||
public class TestFixedWindowRateLimiterGrain : Grain, ITestFixedWindowRateLimiterGrain | ||
{ | ||
[FixedWindowRateLimiter] //GrainId as key, default options | ||
public async Task<string> Do() | ||
{ | ||
await Task.Delay(TimeSpan.FromSeconds(5)); | ||
return "Do"; | ||
} | ||
|
||
[FixedWindowRateLimiter(KeyType.Key, "go")] //String as Key, default options | ||
public async Task<string> Go() | ||
{ | ||
await Task.Delay(TimeSpan.FromSeconds(5)); | ||
return "Go"; | ||
} | ||
|
||
[FixedWindowRateLimiter(KeyType.GrainType, permitLimit:2, queueLimit:1)] //GrainType as Key, custom options, some of them are default (check Attribute) | ||
public async Task<string> Take() | ||
{ | ||
await Task.Delay(TimeSpan.FromSeconds(5)); | ||
return "Take"; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
ManagedCode.Orleans.RateLimiting.Tests/Cluster/Grains/TestSlidingWindowRateLimiterGrain.cs
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,28 @@ | ||
using ManagedCode.Orleans.RateLimiting.Core.Attributes; | ||
using ManagedCode.Orleans.RateLimiting.Tests.Cluster.Grains.Interfaces; | ||
|
||
namespace ManagedCode.Orleans.RateLimiting.Tests.Cluster.Grains; | ||
|
||
public class TestSlidingWindowRateLimiterGrain : Grain, ITestSlidingWindowRateLimiterGrain | ||
{ | ||
[SlidingWindowRateLimiter] //GrainId as key, default options | ||
public async Task<string> Do() | ||
{ | ||
await Task.Delay(TimeSpan.FromSeconds(5)); | ||
return "Do"; | ||
} | ||
|
||
[SlidingWindowRateLimiter(KeyType.Key, "go")] //String as Key, default options | ||
public async Task<string> Go() | ||
{ | ||
await Task.Delay(TimeSpan.FromSeconds(5)); | ||
return "Go"; | ||
} | ||
|
||
[SlidingWindowRateLimiter(KeyType.GrainType, permitLimit:2, queueLimit:1, segmentsPerWindow:2)] //GrainType as Key, custom options, some of them are default (check Attribute) | ||
public async Task<string> Take() | ||
{ | ||
await Task.Delay(TimeSpan.FromSeconds(5)); | ||
return "Take"; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
ManagedCode.Orleans.RateLimiting.Tests/Cluster/Grains/TestTokenBucketRateLimiterGrain.cs
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,28 @@ | ||
using ManagedCode.Orleans.RateLimiting.Core.Attributes; | ||
using ManagedCode.Orleans.RateLimiting.Tests.Cluster.Grains.Interfaces; | ||
|
||
namespace ManagedCode.Orleans.RateLimiting.Tests.Cluster.Grains; | ||
|
||
public class TestTokenBucketRateLimiterGrain : Grain, ITestTokenBucketRateLimiterGrain | ||
{ | ||
[TokenBucketRateLimiter] //GrainId as key, default options | ||
public async Task<string> Do() | ||
{ | ||
await Task.Delay(TimeSpan.FromSeconds(5)); | ||
return "Do"; | ||
} | ||
|
||
[TokenBucketRateLimiter(KeyType.Key, "go")] //String as Key, default options | ||
public async Task<string> Go() | ||
{ | ||
await Task.Delay(TimeSpan.FromSeconds(5)); | ||
return "Go"; | ||
} | ||
|
||
[TokenBucketRateLimiter(KeyType.GrainType, tokenLimit:2, queueLimit:1)] //GrainType as Key, custom options, some of them are default (check Attribute) | ||
public async Task<string> Take() | ||
{ | ||
await Task.Delay(TimeSpan.FromSeconds(5)); | ||
return "Take"; | ||
} | ||
} |
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.