-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathValidator.java
More file actions
50 lines (43 loc) · 1.4 KB
/
Validator.java
File metadata and controls
50 lines (43 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* Copyright D3 Ledger, Inc. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package iroha.validation.validators;
import iroha.protocol.TransactionOuterClass;
import iroha.validation.rules.Rule;
import iroha.validation.verdict.ValidationResult;
import java.util.Set;
/**
* Validator interface. Used as a facade abstraction. Assume a validator can use complex logic
* involving many rules so validators are not parametrized
*/
public interface Validator {
/**
* Method for transaction validation
*
* @param transactions Iroha proto transactions
* @return {@link ValidationResult} corresponding to validating outcome
*/
ValidationResult validate(Iterable<TransactionOuterClass.Transaction> transactions);
/**
* Adds a rule to the rules collection processed by the validator
*
* @param name {@link String Name} of the rule
* @param rule {@link Rule} to be added
* @return previous {@link Rule} associated with the name
*/
Rule putRule(String name, Rule rule);
/**
* Removes a rule from the rules collection processed by the validator
*
* @param name {@link String Name} of the rule to be removed
* @return previous {@link Rule} associated with the name
*/
Rule removeRule(String name);
/**
* Reads all the rule names currently contained in the validator
*
* @return {@link Set} of {@link String names}
*/
Set<String> getRuleNames();
}