Package io.camunda.zeebe.db.impl
Record Class DbTenantAwareKey<WrappedKey extends DbKey>
java.lang.Object
java.lang.Record
io.camunda.zeebe.db.impl.DbTenantAwareKey<WrappedKey>
- All Implemented Interfaces:
ContainsForeignKeys,DbKey,BufferReader,BufferWriter
public record DbTenantAwareKey<WrappedKey extends DbKey>(DbString tenantKey, WrappedKey extends DbKey wrappedKey, DbTenantAwareKey.PlacementType placementType)
extends Record
implements DbKey, ContainsForeignKeys
The DbTenantAwareKey wraps any given key and, depending on the PlacementType, append or prepends
the tenant to it.
Depending on the use case you want to choose whether you need to use PREFIX or SUFFIX. PREFIX is suitable when you want the ability to search values by tenant. Use SUFFIX when you want to search for values irrelevant of tenant.
When using PREFIX it's important to be aware that we could have preferential treatment. Keys in RocksDb are sorted. If we take Jobs as an example, when activating we iterate over all activatable jobs to return to the worker. We don't want to Jobs of tenant AAA to take priority over Jobs of tenant ZZZ. SUFFIX is more suitable for this case.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionDbTenantAwareKey(DbString tenantKey, WrappedKey wrappedKey, DbTenantAwareKey.PlacementType placementType) Creates an instance of aDbTenantAwareKeyrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.intfinal inthashCode()Returns a hash code value for this object.Returns the value of theplacementTyperecord component.Returns the value of thetenantKeyrecord component.final StringtoString()Returns a string representation of this record class.voidwrap(org.agrona.DirectBuffer buffer, int offset, int length) Returns the value of thewrappedKeyrecord component.voidwrite(org.agrona.MutableDirectBuffer buffer, int offset)
-
Constructor Details
-
DbTenantAwareKey
public DbTenantAwareKey(DbString tenantKey, WrappedKey wrappedKey, DbTenantAwareKey.PlacementType placementType) Creates an instance of aDbTenantAwareKeyrecord class.- Parameters:
tenantKey- the value for thetenantKeyrecord componentwrappedKey- the value for thewrappedKeyrecord componentplacementType- the value for theplacementTyperecord component
-
-
Method Details
-
tenantKey
Returns the value of thetenantKeyrecord component.- Returns:
- the value of the
tenantKeyrecord component
-
wrappedKey
Returns the value of thewrappedKeyrecord component.- Returns:
- the value of the
wrappedKeyrecord component
-
wrap
public void wrap(org.agrona.DirectBuffer buffer, int offset, int length) - Specified by:
wrapin interfaceBufferReader
-
getLength
public int getLength()- Specified by:
getLengthin interfaceBufferWriter
-
write
public void write(org.agrona.MutableDirectBuffer buffer, int offset) - Specified by:
writein interfaceBufferWriter
-
containedForeignKeys
- Specified by:
containedForeignKeysin interfaceContainsForeignKeys
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
placementType
Returns the value of theplacementTyperecord component.- Returns:
- the value of the
placementTyperecord component
-