Class VeniceProperties
- All Implemented Interfaces:
Serializable
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.VeniceProperties
(Map<String, String> properties) VeniceProperties
(Properties properties) -
Method Summary
Modifier and TypeMethodDescriptionclipAndFilterNamespace
(String nameSpace) Extracts properties that begin with the specified namespace.clipAndFilterNamespace
(Set<String> namespaces) Extracts properties that begin with any of the specified namespaces.boolean
static long
convertSizeFromLiteral
(String size) static VeniceProperties
empty()
boolean
static VeniceProperties
fromCharSequenceMap
(Map<CharSequence, CharSequence> properties) getAsMap()
boolean
getBoolean
(String key) boolean
getBoolean
(String key, boolean defaultValue) boolean
getBooleanWithAlternative
(String preferredKey, String altKey, boolean defaultValue) double
double
int
int
it.unimi.dsi.fastutil.ints.Int2ObjectMap<String>
getIntKeyedMap
(String key) Retrieves a map from the configuration using the given key, where keys are expected to be integers and values are strings.getListWithAlternative
(String preferredKey, String altKey, List<String> defaultValue) long
long
Retrieves a map from the configuration using the given key, where each entry is a colon-separated string (e.g., "key:value").getOptionalInt
(String name) getOrDefault
(String key, String defaultValue) long
getSizeInBytes
(String name) long
getSizeInBytes
(String name, long defaultValue) getStoreProperties
(String storeName) Get store related properties.getStringWithAlternative
(String preferredKey, String altKey) getStringWithAlternative
(String preferredKey, String altKey, String defaultValue) int
hashCode()
boolean
isEmpty()
keySet()
static String
mapToString
(Map<?, ?> map) Helper function to convert a map to a string representation.void
storeFlattened
(File file) Store all properties in a filevoid
Store all properties to anOutputStream
toString()
toString
(boolean prettyPrint)
-
Constructor Details
-
VeniceProperties
Deprecated.Useempty()
-
VeniceProperties
-
VeniceProperties
-
-
Method Details
-
empty
-
getPropertiesCopy
-
keySet
-
containsKey
-
clipAndFilterNamespace
Extracts properties that begin with the specified namespace.This method identifies all properties that start with the given namespace, removes the namespace prefix, and returns the filtered properties.
This enables support for dynamic configurations (e.g., required by Pub/Sub clients). All properties following a namespace-based convention can be extracted and used by various adapters, such as Pub/Sub Producers or Consumers.
- Parameters:
nameSpace
- The namespace to filter properties by.- Returns:
- A
VeniceProperties
instance containing properties with the namespace removed.
-
clipAndFilterNamespace
Extracts properties that begin with any of the specified namespaces.This method identifies all properties that start with one of the provided namespaces, removes the matching namespace prefix, and returns the filtered properties.
This supports dynamic configurations for various use cases, including Pub/Sub clients, messaging systems, and other configurable components. By following a namespace-based convention, different configurations can be extracted and supplied to respective adapters.
Example structure:
"pubsub.kafka.bootstrap.servers" "pubsub.pulsar.service.url" "pubsub.warpstream.bucket.url"
Using this method with namespaces {"pubsub.kafka.", "pubsub.pulsar."} would result in:
"bootstrap.servers" "service.url"
- Parameters:
namespaces
- A set of namespaces to filter properties by.- Returns:
- A
VeniceProperties
instance containing properties with the matching namespaces removed.
-
getStoreProperties
Get store related properties. properties that do not begin with store- are considered common to all stores. out of properties that begins with store- , only properties that matches the store name are related to current store. These matching properties override the base properties if they are present.- Parameters:
storeName
- name of the store- Returns:
- Properties for the current store.
-
equals
-
hashCode
public int hashCode() -
toString
-
toString
-
storeFlattened
Store all properties in a file- Parameters:
file
- to store into- Throws:
IOException
- If there is an error writing
-
storeFlattened
Store all properties to anOutputStream
- Parameters:
out
- The stream to write to- Throws:
IOException
- If there is an error writing
-
getString
-
getString
-
getStringWithAlternative
-
getString
-
getOrDefault
-
getStringWithAlternative
-
getBoolean
-
getBooleanWithAlternative
-
getBoolean
-
getLong
-
getLong
-
getInt
-
getInt
-
getOptionalInt
-
getDouble
-
getDouble
-
getSizeInBytes
-
getSizeInBytes
-
convertSizeFromLiteral
-
getList
-
getListWithAlternative
-
getList
-
getMap
-
getMap
Retrieves a map from the configuration using the given key, where each entry is a colon-separated string (e.g., "key:value").- Parameters:
key
- the configuration key- Returns:
- an unmodifiable
Map<String, String>
- Throws:
UndefinedPropertyException
- if the key does not existVeniceException
- if any entry is malformed
-
getIntKeyedMap
Retrieves a map from the configuration using the given key, where keys are expected to be integers and values are strings.- Parameters:
key
- the configuration key- Returns:
- an
Int2ObjectMap<String>
of parsed entries - Throws:
UndefinedPropertyException
- if the key does not existVeniceException
- if any entry is malformed or key is not a valid integer
-
mapToString
Helper function to convert a map to a string representation.- Parameters:
map
- The map to convert- Returns:
-
toProperties
-
isEmpty
public boolean isEmpty() -
getAsMap
-
fromCharSequenceMap
-
empty()