Added ElementUpdateStrategy
, renamed SetElement
message to UpdateElement
. Fixes #12
This commit is contained in:
parent
0f3ea0f52a
commit
941cb8e6ab
4 changed files with 13 additions and 4 deletions
|
@ -24,7 +24,7 @@ pub enum MessageContent {
|
|||
content: ElementContent,
|
||||
pot: PotId,
|
||||
},
|
||||
SetElement {
|
||||
UpdateElement {
|
||||
id: ElementId,
|
||||
content: ElementContent,
|
||||
},
|
||||
|
|
|
@ -8,17 +8,19 @@ pub struct Element {
|
|||
pub id: ElementId,
|
||||
pub pot: Option<PotId>,
|
||||
pub content: ElementContent,
|
||||
pub update_strategy: ElementUpdateStrategy,
|
||||
pub latest_message: Option<MessageId>,
|
||||
pub local_changes: bool,
|
||||
}
|
||||
|
||||
impl Element {
|
||||
pub fn new(id: ElementId, content: ElementContent) -> Self {
|
||||
pub fn new(id: ElementId, content: ElementContent, update_strategy: ElementUpdateStrategy) -> Self {
|
||||
// A new element with no latest message must have local changes
|
||||
Element {
|
||||
id: id,
|
||||
pot: None,
|
||||
content,
|
||||
update_strategy,
|
||||
latest_message: None,
|
||||
local_changes: true,
|
||||
}
|
||||
|
@ -40,3 +42,10 @@ impl Element {
|
|||
self.local_changes
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
||||
pub enum ElementUpdateStrategy {
|
||||
Overwrite
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue