Package one.nio.os.bpf
Class BpfMap
- java.lang.Object
-
- one.nio.os.bpf.Handle
-
- one.nio.os.bpf.BpfObj
-
- one.nio.os.bpf.BpfMap
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Direct Known Subclasses:
BpfMap.SynchronizedBpfMap
public class BpfMap extends BpfObj implements java.io.Closeable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classBpfMap.KeysIteratorprivate static classBpfMap.SynchronizedBpfMap-
Nested classes/interfaces inherited from class one.nio.os.bpf.BpfObj
BpfObj.IdsIterator
-
-
Field Summary
Fields Modifier and Type Field Description static intARRAY_KEY_SIZEstatic intCPUSintflagsintkeySizeintmaxEntriesinttotalValueSizeMapTypetypeintvalueSize-
Fields inherited from class one.nio.os.bpf.BpfObj
id, MAX_NAME_LEN, name
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.nio.ByteBufferbytes(byte[] value)static byte[]bytes(int i)static byte[]bytes(long i)private voidcheckKeyLength(int length)private voidcheckTotalValueLength(int length)byte[]get(byte[] key)booleanget(byte[] key, byte[] result)protected booleanget(byte[] key, byte[] result, int flags)static java.lang.Iterable<java.lang.Integer>getAllIds()static BpfMapgetByFd(int fd)static BpfMapgetById(int id)static BpfMapgetPinned(java.lang.String path)static java.nio.IntBufferints(byte[] value)java.lang.Iterable<byte[]>keys()static java.nio.LongBufferlongs(byte[] value)static BpfMapnewMap(MapType type, int keySize, int valueSize, int maxEntries, java.lang.String name, int flags)static BpfMapnewMapOfMaps(MapType type, int keySize, int maxEntries, java.lang.String name, int flags, BpfMap innerMap)static BpfMapnewPerfEventArray(java.lang.String name, int flags)booleanput(byte[] key, byte[] value)protected booleanput(byte[] key, byte[] value, int flags)booleanputIfAbsent(byte[] key, byte[] value)booleanputIfPresent(byte[] key, byte[] value)booleanremove(byte[] key)private static introundUp(int valueSize)BpfMapsynchronizedMap()
-
-
-
Field Detail
-
CPUS
public static final int CPUS
-
ARRAY_KEY_SIZE
public static final int ARRAY_KEY_SIZE
- See Also:
- Constant Field Values
-
type
public final MapType type
-
keySize
public final int keySize
-
valueSize
public final int valueSize
-
totalValueSize
public final int totalValueSize
-
maxEntries
public final int maxEntries
-
flags
public final int flags
-
-
Constructor Detail
-
BpfMap
BpfMap(MapType type, int id, java.lang.String name, int keySize, int valueSize, int maxEntries, int flags, int fd)
-
-
Method Detail
-
roundUp
private static int roundUp(int valueSize)
-
get
public boolean get(byte[] key, byte[] result) throws java.io.IOException- Throws:
java.io.IOException
-
get
protected boolean get(byte[] key, byte[] result, int flags) throws java.io.IOException- Throws:
java.io.IOException
-
get
public byte[] get(byte[] key) throws java.io.IOException- Throws:
java.io.IOException
-
put
public boolean put(byte[] key, byte[] value) throws java.io.IOException- Throws:
java.io.IOException
-
putIfAbsent
public boolean putIfAbsent(byte[] key, byte[] value) throws java.io.IOException- Throws:
java.io.IOException
-
putIfPresent
public boolean putIfPresent(byte[] key, byte[] value) throws java.io.IOException- Throws:
java.io.IOException
-
put
protected boolean put(byte[] key, byte[] value, int flags) throws java.io.IOException- Throws:
java.io.IOException
-
remove
public boolean remove(byte[] key) throws java.io.IOException- Throws:
java.io.IOException
-
keys
public java.lang.Iterable<byte[]> keys()
-
synchronizedMap
public BpfMap synchronizedMap()
-
getPinned
public static BpfMap getPinned(java.lang.String path) throws java.io.IOException
- Throws:
java.io.IOException
-
getById
public static BpfMap getById(int id) throws java.io.IOException
- Throws:
java.io.IOException
-
getByFd
public static BpfMap getByFd(int fd) throws java.io.IOException
- Throws:
java.io.IOException
-
newMap
public static BpfMap newMap(MapType type, int keySize, int valueSize, int maxEntries, java.lang.String name, int flags) throws java.io.IOException
- Throws:
java.io.IOException
-
newMapOfMaps
public static BpfMap newMapOfMaps(MapType type, int keySize, int maxEntries, java.lang.String name, int flags, BpfMap innerMap) throws java.io.IOException
- Throws:
java.io.IOException
-
newPerfEventArray
public static BpfMap newPerfEventArray(java.lang.String name, int flags) throws java.io.IOException
- Throws:
java.io.IOException
-
checkKeyLength
private void checkKeyLength(int length)
-
checkTotalValueLength
private void checkTotalValueLength(int length)
-
getAllIds
public static java.lang.Iterable<java.lang.Integer> getAllIds()
-
bytes
public static byte[] bytes(int i)
-
bytes
public static byte[] bytes(long i)
-
bytes
public static java.nio.ByteBuffer bytes(byte[] value)
-
ints
public static java.nio.IntBuffer ints(byte[] value)
-
longs
public static java.nio.LongBuffer longs(byte[] value)
-
-