-
Notifications
You must be signed in to change notification settings - Fork 217
Add actor state TTL support. #1060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 7 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
d82b0c1
Add actor state TTL support.
artursouza 6f382ff
Scope actorstatestore to actor ITs only.
artursouza 128f5c8
Merge branch 'master' into actor_ttl
artursouza b54a7bb
nit: fix year in header of new file.
artursouza 695a925
Merge branch 'master' into actor_ttl
cicoyle 599c7ff
Merge branch 'master' into actor_ttl
cicoyle 42d4dd4
Merge branch 'master' into actor_ttl
cicoyle 23ab28f
Merge branch 'master' into actor_ttl
artursouza 54343d1
Merge branch 'master' into actor_ttl
artursouza 8dbf275
Address comments
artursouza 8423c5d
Merge branch 'master' into actor_ttl
artursouza 64afdbd
Merge branch 'master' into actor_ttl
cicoyle c46c9da
Merge branch 'master' into actor_ttl
cicoyle 5760b84
Merge branch 'master' into actor_ttl
artursouza d60805f
Merge branch 'master' into actor_ttl
cicoyle 86bb3b3
Merge branch 'master' into actor_ttl
artursouza b6e3d6c
Merge branch 'master' into actor_ttl
artursouza a571359
Merge branch 'master' into actor_ttl
artursouza 4ff319c
Merge branch 'master' into actor_ttl
dapr-bot 15fe5b3
Merge branch 'master' into actor_ttl
artur-ciocanu 39340c4
Update configuration.yaml
artur-ciocanu 6694e2c
Update ActorStateIT.java
artur-ciocanu d9e8445
Update ActorStateIT.java
artur-ciocanu 4152393
Update ActorStateIT.java
artur-ciocanu 4b5afc2
Update ActorStateIT.java
artur-ciocanu 586a232
Merge branch 'master' into actor_ttl
artur-ciocanu 9f3fb11
Merge branch 'master' into actor_ttl
cicoyle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
88 changes: 88 additions & 0 deletions
88
sdk-actors/src/main/java/io/dapr/actors/runtime/ActorState.java
This file contains hidden or 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,88 @@ | ||
/* | ||
* Copyright 2024 The Dapr Authors | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package io.dapr.actors.runtime; | ||
|
||
import java.time.Instant; | ||
|
||
/** | ||
* Represents a state change for an actor. | ||
*/ | ||
final class ActorState<T> { | ||
|
||
/** | ||
* Name of the state being changed. | ||
*/ | ||
private final String name; | ||
|
||
/** | ||
* New value for the state being changed. | ||
*/ | ||
private final T value; | ||
|
||
/** | ||
* Expiration. | ||
*/ | ||
private final Instant expiration; | ||
|
||
/** | ||
* Creates a new instance of the metadata on actor state. | ||
* | ||
* @param name Name of the state being changed. | ||
* @param value Value to be set. | ||
*/ | ||
ActorState(String name, T value) { | ||
this(name, value, null); | ||
} | ||
|
||
/** | ||
* Creates a new instance of the metadata on actor state. | ||
* | ||
* @param name Name of the state being changed. | ||
* @param value Value to be set. | ||
* @param expiration When the value is set to expire (recommended but accepts null). | ||
*/ | ||
ActorState(String name, T value, Instant expiration) { | ||
this.name = name; | ||
this.value = value; | ||
this.expiration = expiration; | ||
} | ||
|
||
/** | ||
* Gets the name of the state being changed. | ||
* | ||
* @return Name of the state. | ||
*/ | ||
String getName() { | ||
return name; | ||
} | ||
|
||
/** | ||
* Gets the new value of the state being changed. | ||
* | ||
* @return New value. | ||
*/ | ||
T getValue() { | ||
return value; | ||
} | ||
|
||
/** | ||
* Gets the expiration of the state. | ||
* | ||
* @return State expiration. | ||
*/ | ||
Instant getExpiration() { | ||
return expiration; | ||
} | ||
|
||
} |
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.