forked from tronprotocol/java-tron
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeStore.java
More file actions
executable file
·43 lines (34 loc) · 1017 Bytes
/
CodeStore.java
File metadata and controls
executable file
·43 lines (34 loc) · 1017 Bytes
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
package org.tron.core.db;
import com.google.common.collect.Streams;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.tron.core.capsule.CodeCapsule;
@Slf4j
@Component
public class CodeStore extends TronStoreWithRevoking<CodeCapsule> {
@Autowired
private CodeStore(@Value("code") String dbName) {
super(dbName);
}
@Override
public CodeCapsule get(byte[] key) {
return getUnchecked(key);
}
public long getTotalCodes() {
return Streams.stream(revokingDB.iterator()).count();
}
private static CodeStore instance;
public static void destory() {
instance = null;
}
void destroy() {
instance = null;
}
public byte[] findCodeByHash(byte[] hash) {
return revokingDB.getUnchecked(hash);
}
}