public class IoCTXStriper extends RadosBase implements AutoCloseable
| Constructor and Description |
|---|
IoCTXStriper(com.sun.jna.Pointer p)
Create a new IO Striper Context object
|
| Modifier and Type | Method and Description |
|---|---|
void |
append(String oid,
byte[] buf)
Append data to an object
|
void |
append(String oid,
byte[] buf,
int len) |
void |
append(String oid,
String buf)
Append data to an object
|
void |
close()
Closes this resource, relinquishing any underlying resources.
|
String |
getExtendedAttribute(String oid,
String xattrName)
Get the value of an extended attribute on an object.
|
com.sun.jna.Pointer |
getPointer()
Return the pointer to the IO Striper Context
|
int |
read(String oid,
int length,
long offset,
byte[] buf)
Read data from an object
|
void |
remove(String oid)
Remove an object
|
void |
removeExtendedAttribute(String oid,
String xattrName)
Delete an extended attribute from an object.
|
void |
setExtendedAttribute(String oid,
String xattrName,
String val)
Set an extended attribute on an object.
|
int |
setStripeCount(int stripeCount)
Sets the object layout's stripe count of a rados striper for future objects.
|
int |
setStripeObjectSize(int stripeObjectSize)
Sets the object layout's object_size of a rados striper for future objects.
|
int |
setStripeUnit(int stripeUnit)
Sets the object layout's stripe unit of a rados striper for future objects.
|
RadosObjectInfo |
stat(String oid)
Stat an object
|
void |
truncate(String oid,
long size)
Resize an object
|
void |
write(String oid,
byte[] buf)
Write to an object without an offset
|
void |
write(String oid,
byte[] buf,
int length,
long offset)
Write to an object
|
void |
write(String oid,
byte[] buf,
long offset)
Write to an object
|
void |
write(String oid,
String buf)
Write to an object without an offset
|
void |
write(String oid,
String buf,
long offset)
Write to an object without an offset
|
void |
writeFull(String oid,
byte[] buf,
int len)
Write an entire object
The object is filled with the provided data.
|
handleReturnCode, throwExceptionpublic IoCTXStriper(com.sun.jna.Pointer p)
This constructor should never be called, IO Context objects are created by the RADOS class and returned when creating a IO Striper Context there
public com.sun.jna.Pointer getPointer()
This method is used internally and by the RADOS class to destroy a IO Context
public void write(String oid, byte[] buf, int length, long offset) throws RadosException, IllegalArgumentException
oid - The object to write tobuf - The content to writelength - The length to writeoffset - The offset when writingRadosExceptionIllegalArgumentExceptionpublic void write(String oid, byte[] buf, long offset) throws RadosException, IllegalArgumentException
oid - The object to write tobuf - The content to writeoffset - The offset when writingRadosExceptionIllegalArgumentExceptionpublic void write(String oid, byte[] buf) throws RadosException
oid - The object to write tobuf - The content to writeRadosExceptionpublic void writeFull(String oid, byte[] buf, int len) throws RadosException
oid - The object to write tobuf - The content to writelen - The length of the data to writeRadosExceptionpublic int setStripeUnit(int stripeUnit)
throws RadosException
stripeUnit - the stripe_unit value of the new object layoutRadosExceptionpublic int setStripeCount(int stripeCount)
throws RadosException
stripeCount - the stripe_count value of the new object layoutRadosExceptionpublic int setStripeObjectSize(int stripeObjectSize)
throws RadosException
stripeObjectSize - the targetted striperRadosExceptionpublic void write(String oid, String buf, long offset) throws RadosException
oid - The object to write tobuf - The content to writeoffset - The offset when writingRadosExceptionpublic void write(String oid, String buf) throws RadosException
oid - The object to write tobuf - The content to writeRadosExceptionpublic int read(String oid, int length, long offset, byte[] buf) throws RadosException
oid - The object's namelength - Amount of bytes to readoffset - The offset where to start readingbuf - The buffer to store the resultRadosExceptionpublic void truncate(String oid, long size) throws RadosException
oid - The object to resizesize - The new length of the object. If this enlarges the object,
the new area is logically filled with
zeroes. If this shrinks the object, the excess data is removed.RadosExceptionpublic void append(String oid, byte[] buf, int len) throws RadosException
oid - The name to append tobuf - The data to appendlen - The number of bytes to write from bufRadosExceptionpublic void append(String oid, byte[] buf) throws RadosException
oid - The name to append tobuf - The data to appendRadosExceptionpublic void append(String oid, String buf) throws RadosException
oid - The name to append tobuf - The data to appendRadosExceptionpublic void remove(String oid) throws RadosException
oid - The object to removeRadosExceptionpublic RadosObjectInfo stat(String oid) throws RadosException
oid - The name of the objectRadosExceptionpublic String getExtendedAttribute(String oid, String xattrName) throws RadosException
oid - The name of the objectxattrName - The name of the extended attributeRadosException - on failure -- common error codes:
-34 (ERANGE) : value exceeds buffer
-61 (ENODATA) : no such attributepublic void setExtendedAttribute(String oid, String xattrName, String val) throws IllegalArgumentException, RadosException
oid - The name of the objectxattrName - The name of the extended attributeval - The value of the extended attributeIllegalArgumentException - attribute value is too longRadosException - on failurepublic void removeExtendedAttribute(String oid, String xattrName) throws RadosException
oid - The name of the objectxattrName - The name of the extended attributeRadosException - on failurepublic void close()
throws Exception
try-with-resources statement.
While this interface method is declared to throw Exception, implementers are strongly encouraged to
declare concrete implementations of the close method to
throw more specific exceptions, or to throw no exception at all
if the close operation cannot fail.
Cases where the close operation may fail require careful
attention by implementers. It is strongly advised to relinquish
the underlying resources and to internally mark the
resource as closed, prior to throwing the exception. The close method is unlikely to be invoked more than once and so
this ensures that the resources are released in a timely manner.
Furthermore it reduces problems that could arise when the resource
wraps, or is wrapped, by another resource.
Implementers of this interface are also strongly advised
to not have the close method throw InterruptedException.
This exception interacts with a thread's interrupted status,
and runtime misbehavior is likely to occur if an InterruptedException is suppressed.
More generally, if it would cause problems for an
exception to be suppressed, the AutoCloseable.close
method should not throw it.
Note that unlike the close
method of Closeable, this close method
is not required to be idempotent. In other words,
calling this close method more than once may have some
visible side effect, unlike Closeable.close which is
required to have no effect if called more than once.
However, implementers of this interface are strongly encouraged
to make their close methods idempotent.
close in interface AutoCloseableException - if this resource cannot be closedCopyright © 2020. All rights reserved.