You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/storage/api/api.rst
+9-30Lines changed: 9 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -798,13 +798,15 @@ These definitions must be defined in the header file :file:`psa/protected_storag
798
798
799
799
A caller may initialize multiple iteration contexts at the same time. Each iteration shall be independent. Calling ``psa_ps_iterator_next()`` on one iterator MUST not effect any other open iteration.
800
800
801
+
An iterator MUST return all data objects whose `uid` matches the filter that are extant when the filter was created, unless these are deleted or renamed before the iteration would return them, or the caller stops before all matching objects have been returned.
802
+
803
+
A caller may delete a `uid` with ``psa_ps_remove(uid)`` without invalidating the iteration context. the iterator MUST never return a `uid` that has been deleted. However, if the caller is multi-threaded it ia possible another thread may delete a `uid`.
804
+
801
805
A caller may read the contents of any `uid` with ``psa_ps_get()`` or write with ``psa_ps_set()`` or ``psa_ps_set_extended()`` without invalidating the iteration context.
802
806
803
-
A caller may create a `uid` with ``psa_ps_set()`` or ``psa_ps_create()`` without invalidating the iteration context, provided the `uid` does *NOT* match the filter. However, if the `uid` matches the filter then any later call to `psa_ps_iterator_next()` fails with `PSA_ERROR_DATA_CORRUPT`.
807
+
A caller may create a `uid` with ``psa_ps_set()`` or ``psa_ps_create()`` without invalidating the iteration context. However, the iterator is NOT guaranteed to return the new object, `uid`, the behaviour is dependent on both implementation and identity. In particular, the iterator is not expected to return `uid` if the iteration is already past the point at which it would naturally be returned.
804
808
805
-
A caller may delete a `uid` with ``psa_ps_remove(uid)`` without invalidating the iteration context, provided the `uid` does *NOT* match the filter. However, if the `uid` matches the filter then any later call to `psa_ps_iterator_next()` fails with `PSA_ERROR_DATA_CORRUPT`.
806
-
807
-
A caller may call `psa_ps_rename(uid, uid_new)` without invalidating the iteration context, provided the `uid` does *NOT* match the filter, as this is equivalent to calling `psa_ps_remove(uid)`. However, if the `uid` matches the filter then any later call to `psa_ps_iterator_next()` fails with `PSA_ERROR_DATA_CORRUPT`.
809
+
A caller may call `psa_ps_rename(uid, uid_new)` without invalidating the iteration context. The iterator must not return `uid`. The iterator is not guaranteed to return `uid_new`, the behaviour is dependent on both implementation and identity.
808
810
809
811
The following code snippet uses a linked list to store the matching files before iterating over that list and removing them.
810
812
@@ -814,23 +816,11 @@ These definitions must be defined in the header file :file:`psa/protected_storag
814
816
my_filter = 0x1111 0000 0000 0000
815
817
my_length = 0x0020
816
818
my_result = NULL
817
-
// define a linked list
818
-
typedef struct node {
819
-
int val;
820
-
struct node * next;
821
-
} node_t;
822
-
// instantiate the head
823
-
node_t * head = NULL;
824
-
head = (node_t *) malloc(sizeof(node_t));
825
-
// and a current item
826
-
node_t * current = head;
827
819
if psa_ps_iterator_start(my_context, my_filter, my-length, my_result) == PSA_SUCCESS
0 commit comments