Package org.elasticsearch.nativeaccess
Class PosixNativeAccess
java.lang.Object
org.elasticsearch.nativeaccess.PosixNativeAccess
- All Implemented Interfaces:
NativeAccess
- Direct Known Subclasses:
LinuxNativeAccess,MacNativeAccess
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.nativeaccess.NativeAccess
NativeAccess.ExecSandboxState -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.elasticsearch.nativeaccess.PosixConstantsprotected NativeAccess.ExecSandboxStateprotected booleanprotected final PosixCLibraryprotected static final Loggerprotected final ProcessLimitsprotected final VectorSimilarityFunctions -
Method Summary
Modifier and TypeMethodDescriptionallocatedSizeInBytes(Path path) Retrieves the actual number of bytes of disk storage used to store a specified file.booleanDetermine whether this JVM is running as the root user.Return whether installing the exec system call filters was successful, and to what degree.protected abstract longReturn the maximum number of threads this process may start, orProcessLimits.UNKNOWN.Return limits for the current process.protected longReturn the current rlimit for the given resource.getZstd()Returns an accessor to zstd compression functions.booleanReturn whether locking memory was successful, or false otherwise.protected abstract voidprotected abstract booleannativePreallocate(int fd, long currentSize, long newSize) newConfinedBuffer(int len) Creates a newCloseableByteBufferusing a confined arena.newSharedBuffer(int len) Creates a newCloseableByteBufferusing a shared arena.systemd()voidAttempt to lock this process's virtual memory address space into physical RAM.voidtryPreallocate(Path file, long newSize) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.nativeaccess.NativeAccess
tryInstallExecSandbox
-
Field Details
-
libc
-
vectorDistance
-
constants
protected final org.elasticsearch.nativeaccess.PosixConstants constants -
processLimits
-
logger
-
isMemoryLocked
protected boolean isMemoryLocked -
execSandboxState
-
-
Method Details
-
getMaxThreads
protected abstract long getMaxThreads()Return the maximum number of threads this process may start, orProcessLimits.UNKNOWN. -
getRLimit
Return the current rlimit for the given resource. If getrlimit fails, returnsProcessLimits.UNKNOWN. If the rlimit is unlimited, returnsProcessLimits.UNLIMITED. -
definitelyRunningAsRoot
public boolean definitelyRunningAsRoot()Description copied from interface:NativeAccessDetermine whether this JVM is running as the root user.- Returns:
- true if running as root, or false if unsure
-
getProcessLimits
Description copied from interface:NativeAccessReturn limits for the current process. -
tryLockMemory
public void tryLockMemory()Description copied from interface:NativeAccessAttempt to lock this process's virtual memory address space into physical RAM. -
logMemoryLimitInstructions
protected abstract void logMemoryLimitInstructions() -
allocatedSizeInBytes
Description copied from interface:NativeAccessRetrieves the actual number of bytes of disk storage used to store a specified file.- Parameters:
path- the path to the file- Returns:
- an
OptionalLongthat contains the number of allocated bytes on disk for the file, or empty if the size is invalid
-
tryPreallocate
-
nativePreallocate
protected abstract boolean nativePreallocate(int fd, long currentSize, long newSize) -
getVectorSimilarityFunctions
-
systemd
- Specified by:
systemdin interfaceNativeAccess
-
getZstd
Description copied from interface:NativeAccessReturns an accessor to zstd compression functions.- Specified by:
getZstdin interfaceNativeAccess- Returns:
- an object used to compress and decompress bytes using zstd
-
newConfinedBuffer
Description copied from interface:NativeAccessCreates a newCloseableByteBufferusing a confined arena. The buffer must be used within the same thread that it is created.- Specified by:
newConfinedBufferin interfaceNativeAccess- Parameters:
len- the number of bytes the buffer should allocate- Returns:
- the buffer
-
isMemoryLocked
public boolean isMemoryLocked()Description copied from interface:NativeAccessReturn whether locking memory was successful, or false otherwise.- Specified by:
isMemoryLockedin interfaceNativeAccess
-
getExecSandboxState
Description copied from interface:NativeAccessReturn whether installing the exec system call filters was successful, and to what degree.- Specified by:
getExecSandboxStatein interfaceNativeAccess
-