forked from Ericsson/ecchronos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto-generate an .md file from the ecc.yml file, and put it in the docs/ folder
- Loading branch information
sajid riaz
committed
Jan 8, 2024
1 parent
287f3c1
commit c41dedf
Showing
3 changed files
with
374 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
...ain/java/com/ericsson/bss/cassandra/ecchronos/application/EccYamlToMarkdownConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package com.ericsson.bss.cassandra.ecchronos.application; | ||
|
||
import java.io.*; | ||
import java.nio.file.Paths; | ||
|
||
public class EccYamlToMarkdownConverter | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
String relativePathToDocs = "docs/autogenerated"; | ||
String markdownFileName = "EccYamlFile.md"; | ||
String yamlFilePath = "/ecc.yml"; // Resource path in the classpath | ||
|
||
String currentWorkingDir = System.getProperty("user.dir"); | ||
String markdownFilePath = Paths.get(currentWorkingDir, relativePathToDocs, markdownFileName).toString(); | ||
|
||
try | ||
{ | ||
convertYamlToMarkdown(yamlFilePath, markdownFilePath); | ||
} | ||
catch (IOException e) | ||
{ | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
private static void convertYamlToMarkdown(String yamlFilePath, String markdownFilePath) throws IOException | ||
{ | ||
try (InputStream inputStream = EccYamlToMarkdownConverter.class.getResourceAsStream(yamlFilePath); | ||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); | ||
BufferedWriter writer = new BufferedWriter(new FileWriter(markdownFilePath))) | ||
{ | ||
|
||
if (inputStream == null) | ||
{ | ||
throw new FileNotFoundException("Resource not found: " + yamlFilePath); | ||
} | ||
|
||
boolean skipLicenseHeader = true; // Skip license header | ||
String line; | ||
while ((line = reader.readLine()) != null) | ||
{ | ||
if (skipLicenseHeader && line.startsWith("#")) | ||
{ | ||
continue; // Skip license header lines | ||
} | ||
skipLicenseHeader = false; | ||
|
||
String markdownLine = convertLineToMarkdown(line); | ||
writer.write(markdownLine); | ||
writer.newLine(); | ||
} | ||
} | ||
} | ||
|
||
private static String convertLineToMarkdown(String line) | ||
{ | ||
String trimmedLine = line.trim(); | ||
|
||
// Handle empty lines and separators | ||
if (trimmedLine.isEmpty() || trimmedLine.equals("---")) | ||
{ | ||
return ""; | ||
} | ||
|
||
// Convert comment lines to regular text (not bold) | ||
if (trimmedLine.startsWith("#")) | ||
{ | ||
return trimmedLine.substring(1).trim(); | ||
} | ||
|
||
// Bold section headers (e.g., "repair:" becomes "**repair:**") | ||
if (trimmedLine.endsWith(":") && !trimmedLine.contains(" ")) | ||
{ | ||
return "**" + trimmedLine + "**"; | ||
} | ||
|
||
// Format key-value pairs (e.g., "host: localhost" becomes "* host: localhost*") | ||
if (trimmedLine.contains(": ") && !trimmedLine.startsWith(" ")) | ||
{ | ||
return "* " + trimmedLine; | ||
} | ||
|
||
return line; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,265 @@ | ||
|
||
## ecChronos configuration | ||
|
||
# Connection | ||
# Properties for connection to the local node | ||
# | ||
**connection:** | ||
**cql:** | ||
# | ||
# Host and port properties for CQL. | ||
# Primarily used by the default connection provider | ||
# | ||
* host: localhost | ||
* port: 9042 | ||
# | ||
# Connection Timeout for CQL. | ||
# Specify a time to wait for cassandra to come up. | ||
# Connection is tried every five second until either the timeout time passes or the connection is successful. | ||
# | ||
**timeout:** | ||
* time: 0 | ||
* unit: seconds | ||
# | ||
# The class used to provide CQL connections to Apache Cassandra. | ||
# The default provider will be used unless another is specified. | ||
# | ||
* provider: com.ericsson.bss.cassandra.ecchronos.application.DefaultNativeConnectionProvider | ||
# | ||
# The class used to provide an SSL context to the NativeConnectionProvider. | ||
# Extending this allows to manipulate the SSLEngine and SSLParameters. | ||
# | ||
* certificateHandler: com.ericsson.bss.cassandra.ecchronos.application.ReloadingCertificateHandler | ||
# | ||
# The class used to decorate CQL statements. | ||
# The default no-op decorator will be used unless another is specified. | ||
# | ||
* decoratorClass: com.ericsson.bss.cassandra.ecchronos.application.NoopStatementDecorator | ||
# | ||
# Allow routing requests directly to a remote datacenter. | ||
# This allows locks for other datacenters to be taken in that datacenter instead of via the local datacenter. | ||
# If clients are prevented from connecting directly to Cassandra nodes in other sites this is not possible. | ||
# If remote routing is disabled its not possible to use LOCAL_SERIAL consistency for the locking, | ||
# instead SERIAL consistency will be used for those request. | ||
# | ||
* remoteRouting: true | ||
**jmx:** | ||
# | ||
# Host and port properties for JMX. | ||
# Primarily used by the default connection provider. | ||
# | ||
* host: localhost | ||
* port: 7199 | ||
# | ||
# The class used to provide JMX connections to Apache Cassandra. | ||
# The default provider will be used unless another is specified. | ||
# | ||
* provider: com.ericsson.bss.cassandra.ecchronos.application.DefaultJmxConnectionProvider | ||
|
||
# Repair configuration | ||
# This section defines default repair behavior for all tables. | ||
# | ||
**repair:** | ||
# | ||
# A class for providing repair configuration for tables. | ||
# The default FileBasedRepairConfiguration uses a schedule.yml file to define per-table configurations. | ||
# | ||
* provider: com.ericsson.bss.cassandra.ecchronos.application.FileBasedRepairConfiguration | ||
# | ||
# How often repairs should be triggered for tables. | ||
# | ||
**interval:** | ||
* time: 7 | ||
* unit: days | ||
# | ||
# The unit of time granularity for priority calculation, can be HOURS, MINUTES, or SECONDS. | ||
# This unit is used in the calculation of priority. | ||
# Default is HOURS for backward compatibility. | ||
# Ensure to pause repair operations prior to changing the granularity. | ||
# Not doing so may lead to inconsistencies as some ecchronos instances | ||
# could have different priorities compared to others for the same repair. | ||
# Possible values are HOURS, MINUTES, or SECONDS. | ||
# | ||
**priority:** | ||
* granularity_unit: HOURS | ||
# | ||
# Specifies the type of lock to use for repairs. | ||
# "vnode" will lock each node involved in a repair individually and increase the number of | ||
# parallel repairs that can run in a single data center. | ||
# "datacenter" will lock each data center involved in a repair and only allow a single repair per data center. | ||
# "datacenter_and_vnode" will combine both options and allow a smooth transition between them without allowing | ||
# multiple repairs to run concurrently on a single node. | ||
# | ||
* lock_type: vnode | ||
# | ||
# Alarms are triggered when tables have not been repaired for a long amount of time. | ||
# The warning alarm is meant to indicate early that repairs are falling behind. | ||
# The error alarm is meant to indicate that gc_grace has passed between repairs. | ||
# | ||
# With the defaults where repairs triggers once every 7 days for each table a warning alarm would be raised | ||
# if the table has not been properly repaired within one full day. | ||
# | ||
**alarm:** | ||
# | ||
# The class used for fault reporting | ||
# The default LoggingFaultReporter will log when alarm is raised/ceased | ||
# | ||
* faultReporter: com.ericsson.bss.cassandra.ecchronos.fm.impl.LoggingFaultReporter | ||
# | ||
# If a table has not been repaired for the following duration an warning alarm will be raised. | ||
# The schedule will be marked as late if the table has not been repaired within this interval. | ||
# | ||
**warn:** | ||
* time: 8 | ||
* unit: days | ||
# | ||
# If a table has not been repaired for the following duration an error alarm will be raised. | ||
# The schedule will be marked as overdue if the table has not been repaired within this interval. | ||
# | ||
**error:** | ||
* time: 10 | ||
* unit: days | ||
# | ||
# Specifies the unwind ratio to smooth out the load that repairs generate. | ||
# This value is a ratio between 0 -> 100% of the execution time of a repair session. | ||
# | ||
# 100% means that the executor will wait to run the next session for as long time as the previous session took. | ||
# | ||
* unwind_ratio: 0.0 | ||
# | ||
# Specifies the lookback time for when the repair_history table is queried to get initial repair state at startup. | ||
# The time should match the "expected TTL" of the system_distributed.repair_history table. | ||
# | ||
**history_lookback:** | ||
* time: 30 | ||
* unit: days | ||
# | ||
# Specifies a target for how much data each repair session should process. | ||
# This is only supported if using 'vnode' as repair_type. | ||
# This is an estimation assuming uniform data distribution among partition keys. | ||
# The value should be either a number or a number with a unit of measurement: | ||
# 12 (12 B) | ||
# 12k (12 KiB) | ||
# 12m (12 MiB) | ||
# 12g (12 GiB) | ||
# | ||
**size_target:** | ||
# | ||
# Specifies the repair history provider used to determine repair state. | ||
# The "cassandra" provider uses the repair history generated by the database. | ||
# The "upgrade" provider is an intermediate state reading history from "cassandra" and producing history for "ecc" | ||
# The "ecc" provider maintains and uses an internal repair history in a dedicated table. | ||
# The main context for the "ecc" provider is an environment where the ip address of nodes might change. | ||
# Possible values are "ecc", "upgrade" and "cassandra". | ||
# | ||
# The keyspace parameter is only used by "ecc" and "upgrade" and points to the keyspace where the custom | ||
# 'repair_history' table is located. | ||
# | ||
**history:** | ||
* provider: ecc | ||
* keyspace: ecchronos | ||
# | ||
# Specifies if tables with TWCS (TimeWindowCompactionStrategy) should be ignored for repair | ||
# | ||
* ignore_twcs_tables: false | ||
# | ||
# Specifies the backoff time for a job. | ||
# This is the time that the job will wait before trying to run again after failing. | ||
# | ||
**backoff:** | ||
* time: 30 | ||
* unit: MINUTES | ||
# | ||
# Specifies the default repair_type. | ||
# Possible values are: vnode, parallel_vnode, incremental | ||
# vnode = repair 1 vnode at a time (supports size_target to split the vnode further, in this case there will be 1 repair session per subrange) | ||
# parallel_vnode = repair vnodes in parallel, this will combine vnodes into a single repair session per repair group | ||
# incremental = repair vnodes incrementally (incremental repair) | ||
# | ||
* repair_type: vnode | ||
|
||
**statistics:** | ||
* enabled: true | ||
# | ||
# Decides how statistics should be exposed. | ||
# If all reporting is disabled, the statistics will be disabled as well. | ||
# | ||
**reporting:** | ||
**jmx:** | ||
* enabled: true | ||
# | ||
# The metrics can be excluded on name and on tag values using quoted regular expressions. | ||
# Exclusion on name should be done without the prefix. | ||
# If an exclusion is without tags, then metric matching the name will be excluded. | ||
# If both name and tags are specified, then the metric must match both to be excluded. | ||
# If multiple tags are specified, the metric must match all tags to be excluded. | ||
# By default, no metrics are excluded. | ||
# For list of available metrics and tags refer to the documentation. | ||
# | ||
* excludedMetrics: [] | ||
**file:** | ||
* enabled: true | ||
# | ||
# The metrics can be excluded on name and on tag values using quoted regular expressions. | ||
# Exclusion on name should be done without the prefix. | ||
# If an exclusion is without tags, then metric matching the name will be excluded. | ||
# If both name and tags are specified, then the metric must match both to be excluded. | ||
# If multiple tags are specified, the metric must match all tags to be excluded. | ||
# By default, no metrics are excluded. | ||
# For list of available metrics and tags refer to the documentation. | ||
# | ||
* excludedMetrics: [] | ||
**http:** | ||
* enabled: true | ||
# | ||
# The metrics can be excluded on name and on tag values using quoted regular expressions. | ||
# Exclusion on name should be done without the prefix. | ||
# If an exclusion is without tags, then metric matching the name will be excluded. | ||
# If both name and tags are specified, then the metric must match both to be excluded. | ||
# If multiple tags are specified, the metric must match all tags to be excluded. | ||
# By default, no metrics are excluded. | ||
# For list of available metrics and tags refer to the documentation. | ||
# | ||
* excludedMetrics: [] | ||
* directory: ./statistics | ||
# | ||
# Prefix all metrics with below string | ||
# The prefix cannot start or end with a dot or any other path separator. | ||
# | ||
* prefix: '' | ||
|
||
**lock_factory:** | ||
**cas:** | ||
# | ||
# The keyspace used for the CAS lock factory tables. | ||
# | ||
* keyspace: ecchronos | ||
# | ||
# The number of seconds until the lock failure cache expires. | ||
# If an attempt to secure a lock is unsuccessful, | ||
# all subsequent attempts will be failed until | ||
# the cache expiration time is reached. | ||
# | ||
* cache_expiry_time_in_seconds: 30 | ||
|
||
**run_policy:** | ||
**time_based:** | ||
# | ||
# The keyspace used for the time based run policy tables. | ||
# | ||
* keyspace: ecchronos | ||
|
||
**scheduler:** | ||
# | ||
# Specifies the frequency the scheduler checks for work to be done | ||
# | ||
**frequency:** | ||
* time: 30 | ||
* unit: SECONDS | ||
|
||
**rest_server:** | ||
# | ||
# The host and port used for the HTTP server | ||
# | ||
* host: localhost | ||
* port: 8080 |