Skip to content

Commit 41b97ba

Browse files
author
Nathan Memmott
committed
Create lock type
1 parent f56615c commit 41b97ba

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

index.bs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,31 +124,30 @@ Issue: We should consider having further normative restrictions on file names th
124124
never be allowed using this API, rather than leaving it entirely up to underlying file
125125
systems.
126126

127+
A <dfn>lock type</dfn> is a [=string=] that may exclusively be "`open`",
128+
"`exclusive`", or "`shared`".
129+
127130
A <dfn export id=file>file entry</dfn> additionally consists of
128131
<dfn for="file entry" export>binary data</dfn> (a [=byte sequence=]), a
129132
<dfn for="file entry">modification timestamp</dfn> (a number representing the number of milliseconds since the <a spec=FileAPI>Unix Epoch</a>),
130-
a <dfn for="file entry">lock</dfn> (a string that may exclusively be "`open`", "`taken-exclusive`" or "`taken-shared`")
133+
a <dfn for="file entry">lock</dfn> (a [=lock type=]),
131134
and a <dfn for="file entry">lock count</dfn> (a number representing the number of locks that are taken at a given point in time).
132135

133136
A user agent has an associated <dfn>file system queue</dfn> which is the
134137
result of [=starting a new parallel queue=]. This queue is to be used for all
135138
file system operations.
136139

137140
<div algorithm>
138-
To <dfn for="file entry" id=file-entry-lock-take>take a lock</dfn> with a |value| of
139-
"`exclusive`" or "`shared`" on a given [=file entry=] |file|:
141+
To <dfn for="file entry" id=file-entry-lock-take>take a lock</dfn> with a |lockType| (a [=lock type=])
142+
on a given [=file entry=] |file|:
140143

144+
1. [=Assert=]: |lockType| is not "`open`".
141145
1. Let |lock| be the |file|'s [=file entry/lock=].
142146
1. Let |count| be the |file|'s [=file entry/lock count=].
143147
1. If |lock| is not "`open`":
144-
1. If |value| is "`exclusive`" or |lock| is "`taken-exclusive`":
148+
1. If |lockType| is "`exclusive`" or |lock| is not equal to |lockType|:
145149
1. Return "`failure`".
146-
1. If |value| is "`exclusive`":
147-
1. [=Assert=]: |lock| is "`open`".
148-
1. [=Assert=]: |count| is 0.
149-
1. Set |lock| to "`taken-exclusive`".
150-
1. Otherwise:
151-
1. Set |lock| to "`taken-shared`".
150+
1. Set |lock| to |lockType|.
152151
1. Increase |count| by 1.
153152
1. Return "`success`".
154153

0 commit comments

Comments
 (0)