Unit tests for ClientBackedDataStore class
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / yang / distributed-datastore-provider.yang
index 0471bc806e00d65e973432b4faa7dea90e593516..d14c828809e727eb8bf8dca08f1cae8cbc8f4d8e 100644 (file)
@@ -7,6 +7,10 @@ module distributed-datastore-provider {
 
     import config { prefix config; revision-date 2013-04-05; }
     import rpc-context { prefix rpcx; revision-date 2013-06-17; }
+    import opendaylight-config-dom-datastore {prefix config-dom-store-spi;}
+    import opendaylight-operational-dom-datastore {prefix operational-dom-store-spi;}
+    import opendaylight-md-sal-dom {prefix sal;}
+    import actor-system-provider-service {prefix actor-system;}
 
     description
         "This module contains the base YANG definitions for
@@ -18,17 +22,287 @@ module distributed-datastore-provider {
     }
 
     // This is the definition of the service implementation as a module identity.
-    identity distributed-datastore-provider {
+    identity distributed-config-datastore-provider {
             base config:module-type;
-
+            config:provided-service config-dom-store-spi:config-dom-datastore;
             // Specifies the prefix for generated java classes.
-            config:java-name-prefix DistributedDataStoreProvider;
+            config:java-name-prefix DistributedConfigDataStoreProvider;
+    }
+
+     // This is the definition of the service implementation as a module identity.
+     identity distributed-operational-datastore-provider {
+                base config:module-type;
+                config:provided-service operational-dom-store-spi:operational-dom-datastore;
+                // Specifies the prefix for generated java classes.
+                config:java-name-prefix DistributedOperationalDataStoreProvider;
+     }
+
+    typedef non-zero-uint32-type {
+        type uint32 {
+            range "1..max";
+        }
+    }
+
+    typedef operation-timeout-type {
+        type uint16 {
+            range "5..max";
+        }
+    }
+
+    typedef heartbeat-interval-type {
+        type uint16 {
+            range "100..max";
+        }
+    }
+
+    typedef percentage {
+        type uint8 {
+            range "0..100";
+        }
+    }
+
+    grouping data-store-properties {
+        leaf max-shard-data-change-executor-queue-size {
+            default 1000;
+            type non-zero-uint32-type;
+            description "The maximum queue size for each shard's data store data change notification executor.";
+        }
+
+        leaf max-shard-data-change-executor-pool-size {
+            default 20;
+            type non-zero-uint32-type;
+            description "The maximum thread pool size for each shard's data store data change notification executor.";
+        }
+
+        leaf max-shard-data-change-listener-queue-size {
+            default 1000;
+            type non-zero-uint32-type;
+            description "The maximum queue size for each shard's data store data change listener.";
+        }
+
+        leaf max-shard-data-store-executor-queue-size {
+            default 5000;
+            type non-zero-uint32-type;
+            description "The maximum queue size for each shard's data store executor.";
+        }
+
+        leaf shard-transaction-idle-timeout-in-minutes {
+            default 10;
+            type non-zero-uint32-type;
+            description "The maximum amount of time a shard transaction can be idle without receiving any messages before it self-destructs.";
+        }
+
+        leaf shard-snapshot-batch-count {
+            default 20000;
+            type non-zero-uint32-type;
+            description "The minimum number of entries to be present in the in-memory journal log before a snapshot is to be taken.";
+        }
+
+        leaf shard-snapshot-data-threshold-percentage {
+            default 12;
+            type percentage;
+            description "The percentage of Runtime.maxMemory() used by the in-memory journal log before a snapshot is to be taken";
+        }
+
+
+        leaf shard-heartbeat-interval-in-millis {
+            default 500;
+            type heartbeat-interval-type;
+            description "The interval at which a shard will send a heart beat message to its remote shard.";
+        }
+
+        leaf shard-election-timeout-factor {
+            default 20;
+            type non-zero-uint32-type;
+            description "The multiplication factor to be used to determine shard election timeout. The shard election timeout
+                         is determined by multiplying shard-heartbeat-interval-in-millis with the shard-election-timeout-factor";
+        }
+
+        leaf operation-timeout-in-seconds {
+            default 5;
+            type operation-timeout-type;
+            description "The maximum amount of time for akka operations (remote or local) to complete before failing.";
+        }
+
+        leaf shard-journal-recovery-log-batch-size {
+            default 1;
+            type non-zero-uint32-type;
+            description "The maximum number of journal log entries to batch on recovery for a shard before committing to the data store.";
+        }
+
+        leaf shard-transaction-commit-timeout-in-seconds {
+            default 30;
+            type non-zero-uint32-type;
+            description "The maximum amount of time a shard transaction three-phase commit can be idle without receiving the next messages before it aborts the transaction";
+        }
+
+        leaf shard-transaction-commit-queue-capacity {
+            default 50000;
+            type non-zero-uint32-type;
+            description "The maximum allowed capacity for each shard's transaction commit queue.";
+        }
+
+        leaf shard-commit-queue-expiry-timeout-in-seconds {
+            default 120; // 2 minutes
+            type non-zero-uint32-type;
+            description "The maximum amount of time a transaction can remain in a shard's commit queue waiting
+                to begin the CanCommit phase as coordinated by the broker front-end. Normally this should be
+                quick but latencies can occur in between transaction ready and CanCommit or a remote broker
+                could lose connection and CanCommit might never occur. Expiring transactions from the queue
+                allows subsequent pending transaction to be processed.";
+        }
+
+        leaf shard-initialization-timeout-in-seconds {
+            default 300; // 5 minutes
+            type non-zero-uint32-type;
+            description "The maximum amount of time to wait for a shard to initialize from persistence
+                         on startup before failing an operation (eg transaction create and change
+                         listener registration).";
+        }
+
+        leaf shard-leader-election-timeout-in-seconds {
+            default 30;
+            type non-zero-uint32-type;
+            description "The maximum amount of time to wait for a shard to elect a leader before failing
+                          an operation (eg transaction create).";
+        }
+
+        leaf shard-batched-modification-count {
+            default 1000;
+            type non-zero-uint32-type;
+            description "The number of transaction modification operations (put, merge, delete) to
+                        batch before sending to the shard transaction actor. Batching improves
+                        performance as less modifications messages are sent to the actor and thus
+                        lessens the chance that the transaction actor's mailbox queue could get full.";
+        }
+
+        leaf enable-metric-capture {
+            default false;
+            type boolean;
+            description "Enable or disable metric capture.";
+        }
+
+        leaf bounded-mailbox-capacity {
+            default 1000;
+            type non-zero-uint32-type;
+            description "Max queue size that an actor's mailbox can reach";
+        }
+
+        leaf persistent {
+            default true;
+            type boolean;
+            description "Enable or disable data persistence";
+        }
+
+        leaf shard-isolated-leader-check-interval-in-millis {
+            default 5000;
+            type heartbeat-interval-type;
+            description "The interval at which the leader of the shard will check if its majority
+                        followers are active and term itself as isolated";
+        }
+
+        leaf transaction-creation-initial-rate-limit {
+            default 100;
+            type non-zero-uint32-type;
+            description "The initial number of transactions per second that are allowed before the data store
+                         should begin applying back pressure. This number is only used as an initial guidance,
+                         subsequently the datastore measures the latency for a commit and auto-adjusts the rate limit";
+        }
+
+        leaf transaction-debug-context-enabled {
+            default false;
+            type boolean;
+            description "Enable or disable transaction context debug. This will log the call site trace for
+                         transactions that fail";
+        }
+
+        leaf custom-raft-policy-implementation {
+            default "";
+            type string;
+            description "A fully qualified java class name. The class should implement
+                         org.opendaylight.controller.cluster.raft.policy.RaftPolicy. This java class should be
+                         accessible to the distributed data store OSGi module so that it can be dynamically loaded via
+                         reflection. For now let's assume that these classes to customize raft behaviors should be
+                         present in the distributed data store module itself. If this property is set to a class which
+                         cannot be found then the default raft behavior will be applied";
+        }
+
+        leaf shard-snapshot-chunk-size {
+            default 2048000;
+            type non-zero-uint32-type;
+            description "When sending a snapshot to a follower, this is the maximum size in bytes for
+                         a chunk of data.";
+        }
+
+        leaf use-tell-based-protocol {
+            default false;
+            type boolean;
+            description "Use a newer protocol between the frontend and backend. This feature is considered
+                         exprerimental at this point.";
+        }
+
+        leaf file-backed-streaming-threshold-in-megabytes {
+            default 128;
+            type non-zero-uint32-type;
+            description "When streaming large amounts of data, eg when sending a snapshot to a follower, this
+                is the threshold in terms of number of megabytes before it should switch from storing in memory to
+                buffering to a file.";
+        }
     }
 
     // Augments the 'configuration' choice node under modules/module.
     augment "/config:modules/config:module/config:configuration" {
-        case distributed-datastore-provider {
-            when "/config:modules/config:module/config:type = 'distributed-datastore-provider'";
+        case distributed-config-datastore-provider {
+            when "/config:modules/config:module/config:type = 'distributed-config-datastore-provider'";
+                container config-schema-service {
+                    uses config:service-ref {
+                        refine type {
+                            mandatory false;
+                            config:required-identity sal:schema-service;
+                        }
+                    }
+                }
+
+                container config-actor-system-provider {
+                    uses config:service-ref {
+                        refine type {
+                            mandatory false;
+                            config:required-identity actor-system:actor-system-provider-service;
+                        }
+                    }
+                }
+
+                container config-properties {
+                    uses data-store-properties;
+                }
+        }
+    }
+
+    // Augments the 'configuration' choice node under modules/module.
+    augment "/config:modules/config:module/config:configuration" {
+        case distributed-operational-datastore-provider {
+            when "/config:modules/config:module/config:type = 'distributed-operational-datastore-provider'";
+                container operational-schema-service {
+                    uses config:service-ref {
+                        refine type {
+                            mandatory false;
+                            config:required-identity sal:schema-service;
+                        }
+                    }
+                }
+
+                container operational-actor-system-provider {
+                    uses config:service-ref {
+                        refine type {
+                            mandatory false;
+                            config:required-identity actor-system:actor-system-provider-service;
+                        }
+                    }
+                }
+
+                container operational-properties {
+                    uses data-store-properties;
+                }
         }
     }
 }