@ThreadSafe public class FusePositionReadOrOutStream extends Object implements FuseFileStream
FuseFileStream
for read only or write only workloads.
Fuse can open file for reading and writing concurrently but Alluxio only support
read-only or write-only workloads. This class will be used as write only stream
if O_TRUNC flag is provided or first operation is write() or truncate(),
will be used as read only stream otherwise.Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the stream and releases the lock.
|
void |
closeStream()
Closes the stream without releasing the locking resource.
|
static FusePositionReadOrOutStream |
create(FileSystem fileSystem,
AuthPolicy authPolicy,
FuseReadWriteLockManager lockManager,
AlluxioURI uri,
int flags,
long mode)
Creates a
FuseFileInOrOutStream . |
void |
flush()
Flushes the stream.
|
FileStatus |
getFileStatus() |
boolean |
isClosed() |
boolean |
isReadOnly() |
int |
read(ByteBuffer buf,
long size,
long offset)
Reads data from the stream.
|
void |
releaseLock()
Releases the lock resource the stream obtained.
|
void |
truncate(long size)
Truncates the file to the given size.
|
void |
write(ByteBuffer buf,
long size,
long offset)
Writes data to the stream.
|
public static FusePositionReadOrOutStream create(FileSystem fileSystem, AuthPolicy authPolicy, FuseReadWriteLockManager lockManager, AlluxioURI uri, int flags, long mode)
FuseFileInOrOutStream
.fileSystem
- the Alluxio file systemauthPolicy
- the Authentication policylockManager
- the lock manageruri
- the alluxio uriflags
- the fuse create/open flagsmode
- the filesystem mode, -1 if not setFuseFileInOrOutStream
public int read(ByteBuffer buf, long size, long offset)
FuseFileStream
read
in interface FuseFileStream
buf
- the byte buffer to read data tosize
- the size to readoffset
- the offset of the target stream to begin readingpublic void write(ByteBuffer buf, long size, long offset)
FuseFileStream
write
in interface FuseFileStream
buf
- the byte buffer to read data from and write to the streamsize
- the size to writeoffset
- the offset to writepublic FileStatus getFileStatus()
getFileStatus
in interface FuseFileStream
public void flush()
FuseFileStream
flush
in interface FuseFileStream
public void truncate(long size)
FuseFileStream
truncate
in interface FuseFileStream
size
- the truncate sizepublic void close()
FuseFileStream
close
in interface FuseFileStream
close
in interface AutoCloseable
public boolean isClosed()
isClosed
in interface FuseFileStream
public boolean isReadOnly()
isReadOnly
in interface FuseFileStream
public void releaseLock()
FuseFileStream
releaseLock
in interface FuseFileStream
public void closeStream()
FuseFileStream
closeStream
in interface FuseFileStream
Copyright © 2023. All Rights Reserved.