@@ -28,6 +28,12 @@ use crate::{
28
28
// TODO: For now...
29
29
static SUBS_ID : AtomicU32 = AtomicU32 :: new ( 1 ) ;
30
30
31
+ /// The Maximum number of expanded writer request per transaction
32
+ ///
33
+ /// The write requests are first wildcard-expanded, and these many number of
34
+ /// write requests per-transaction will be supported.
35
+ pub const MAX_WRITE_ATTRS_IN_ONE_TRANS : usize = 7 ;
36
+
31
37
pub struct DataModel < T > ( T ) ;
32
38
33
39
impl < T > DataModel < T > {
@@ -93,8 +99,21 @@ impl<T> DataModel<T> {
93
99
ref mut driver,
94
100
} => {
95
101
let accessor = driver. accessor ( ) ?;
96
-
97
- for item in metadata. node ( ) . write ( req, & accessor) {
102
+ // The spec expects that a single write request like DeleteList + AddItem
103
+ // should cause all ACLs of that fabric to be deleted and the new one to be added (Case 1).
104
+ //
105
+ // This is in conflict with the immediate-effect expectation of ACL: an ACL
106
+ // write should instantaneously update the ACL so that immediate next WriteAttribute
107
+ // *in the same WriteRequest* should see that effect (Case 2).
108
+ //
109
+ // As with the C++ SDK, here we do all the ACLs checks first, before any write begins.
110
+ // Thus we support the Case1 by doing this. It does come at the cost of maintaining an
111
+ // additional list of expanded write requests as we start processing those.
112
+ let node = metadata. node ( ) ;
113
+ let write_attrs: heapless:: Vec < _ , MAX_WRITE_ATTRS_IN_ONE_TRANS > =
114
+ node. write ( req, & accessor) . collect ( ) ;
115
+
116
+ for item in write_attrs {
98
117
AttrDataEncoder :: handle_write ( & item, & self . 0 , & mut driver. writer ( ) ?)
99
118
. await ?;
100
119
}
0 commit comments