Class: RStyx::Server::SFileClient
- Inherits:
-
Object
- Object
- RStyx::Server::SFileClient
- Defined in:
- lib/rstyx/server.rb
Overview
Server’s representation of the client of an SFile, created when a client opens a file.
Instance Attribute Summary collapse
-
#fid ⇒ Object
readonly
The fid which the client used to open the file in question.
-
#mode ⇒ Object
readonly
The mode under which the client opened the file in question.
-
#next_file_to_read ⇒ Object
Used when reading a directory: stores the index of the next child of an SFile to include in an RreadMessage.
-
#offset ⇒ Object
When a client reads from or writes to file, this records the new offset.
-
#session ⇒ Object
readonly
The session for which this SFileClient was created.
Instance Method Summary collapse
-
#initialize(session, fid, mode) ⇒ SFileClient
constructor
Create a new SFileClient.
-
#orclose? ⇒ Boolean
(also: #delete_on_clunk?)
Returns true if the Styx file was opened by the client in the ORCLOSE mode (i.e. the client wants the file deleted on clunk).
-
#readable? ⇒ Boolean
Check to see if the client can read the file (i.e. the client opened it with read access mode).
-
#truncate? ⇒ Boolean
Returns true if the Styx file was opened by the client in the OTRUNC mode.
-
#writable? ⇒ Boolean
Check to see if the client can write to the file (i.e. the client opened it with write access).
Constructor Details
#initialize(session, fid, mode) ⇒ SFileClient
1136 1137 1138 1139 1140 1141 1142 1143 1144 |
# File 'lib/rstyx/server.rb', line 1136 def initialize(session, fid, mode) @session = session @fid = fid @truncate = ((mode & OTRUNC) == OTRUNC) @orclose = ((mode & ORCLOSE) == ORCLOSE) @mode = mode & 0x03 # mask off all but the last two bits @offset = 0 @next_file_to_read = 0 end |
Instance Attribute Details
#fid ⇒ Object (readonly)
The fid which the client used to open the file in question
1114 1115 1116 |
# File 'lib/rstyx/server.rb', line 1114 def fid @fid end |
#mode ⇒ Object (readonly)
The mode under which the client opened the file in question
1117 1118 1119 |
# File 'lib/rstyx/server.rb', line 1117 def mode @mode end |
#next_file_to_read ⇒ Object
Used when reading a directory: stores the index of the next child of an SFile to include in an RreadMessage.
1125 1126 1127 |
# File 'lib/rstyx/server.rb', line 1125 def next_file_to_read @next_file_to_read end |
#offset ⇒ Object
When a client reads from or writes to file, this records the new offset
1121 1122 1123 |
# File 'lib/rstyx/server.rb', line 1121 def offset @offset end |
#session ⇒ Object (readonly)
The session for which this SFileClient was created
1111 1112 1113 |
# File 'lib/rstyx/server.rb', line 1111 def session @session end |
Instance Method Details
#orclose? ⇒ Boolean Also known as: delete_on_clunk?
Returns true if the Styx file was opened by the client in the ORCLOSE mode (i.e. the client wants the file deleted on clunk).
1158 1159 1160 |
# File 'lib/rstyx/server.rb', line 1158 def orclose? return(@orclose) end |
#readable? ⇒ Boolean
Check to see if the client can read the file (i.e. the client opened it with read access mode).
1168 1169 1170 |
# File 'lib/rstyx/server.rb', line 1168 def readable? return(@mode == OREAD || @mode == ORDWR) end |
#truncate? ⇒ Boolean
Returns true if the Styx file was opened by the client in the OTRUNC mode.
1150 1151 1152 |
# File 'lib/rstyx/server.rb', line 1150 def truncate? return(@truncate) end |