• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

codenotary / immudb4j / #149

26 Jul 2026 09:37AM UTC coverage: 82.814% (+0.5%) from 82.32%
#149

push

github

web-flow
update ImmuClientverifiedGet  to return  `VerifiableEntry` instead of`Entry` (#79)

* Update ImmuClient.verifiedGet to return instance of VerifiableEntry as per schema.proto rpc VerifiableGet

(cherry picked from commit be6c674c5)

* Add override methods documentation, add new constructor for Entry which supports all current properties and make Entry immutable

65 of 68 new or added lines in 5 files covered. (95.59%)

104 existing lines in 1 file now uncovered.

1595 of 1926 relevant lines covered (82.81%)

0.83 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

97.37
/src/main/java/io/codenotary/immudb4j/Entry.java
1
/*
2
Copyright 2022 CodeNotary, Inc. All rights reserved.
3

4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
7

8
        http://www.apache.org/licenses/LICENSE-2.0
9

10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
15
*/
16
package io.codenotary.immudb4j;
17

18
import io.codenotary.immudb.ImmudbProto;
19

20
public class Entry {
21
    private final long tx;
22

23
    private final byte[] key;
24

25
    private final byte[] value;
26

27
    private final KVMetadata metadata;
28

29
    private final Reference referencedBy;
30

31
    private final long revision;
32

33
    public Entry(byte[] key, byte[] value) {
34
        this(0L, key, value, null, null, 0L);
1✔
35
    }
1✔
36

37
    Entry(long tx,
38
          byte[] key,
39
          byte[] value,
40
          KVMetadata metadata,
41
          Reference referencedBy,
42
          long revision) {
1✔
43
        this.tx = tx;
1✔
44
        this.key = key;
1✔
45
        this.value = value;
1✔
46
        this.metadata = metadata;
1✔
47
        this.referencedBy = referencedBy;
1✔
48
        this.revision = revision;
1✔
49
    }
1✔
50

51
    public static Entry valueOf(ImmudbProto.Entry e) {
52

53
        KVMetadata metadata = null;
1✔
54
        if (e.hasMetadata()) {
1✔
NEW
55
            metadata = KVMetadata.valueOf(e.getMetadata());
×
56
        }
57
        Reference referencedBy = null;
1✔
58
        if (e.hasReferencedBy()) {
1✔
59
            referencedBy = Reference.valueOf(e.getReferencedBy());
1✔
60
        }
61
        return new Entry(e.getTx(),
1✔
62
                e.getKey().toByteArray(),
1✔
63
                e.getValue().toByteArray(),
1✔
64
                metadata,
65
                referencedBy,
66
                e.getRevision());
1✔
67
    }
68

69
    public long getTx() {
70
        return tx;
1✔
71
    }
72

73
    public byte[] getKey() {
74
        return key;
1✔
75
    }
76

77
    public byte[] getValue() {
78
        return value;
1✔
79
    }
80

81
    public KVMetadata getMetadata() {
82
        return metadata;
1✔
83
    }
84

85
    public Reference getReferenceBy() {
86
        return referencedBy;
1✔
87
    }
88

89
    public long getRevision() {
90
        return revision;
1✔
91
    }
92

93
    public byte[] getEncodedKey() {
94
        if (referencedBy == null) {
1✔
95
            return Utils.wrapWithPrefix(key, Consts.SET_KEY_PREFIX);
1✔
96
        }
97

98
        return Utils.wrapWithPrefix(referencedBy.getKey(), Consts.SET_KEY_PREFIX);
1✔
99
    }
100

101
    public byte[] digestFor(int version) {
102
        final KV kv;
103

104
        if (referencedBy == null) {
1✔
105
            kv = new KV(
1✔
106
                    getEncodedKey(),
1✔
107
                    metadata,
108
                    Utils.wrapWithPrefix(value, Consts.PLAIN_VALUE_PREFIX)
1✔
109
            );
110
        } else {
111
            kv = new KV(
1✔
112
                    getEncodedKey(),
1✔
113
                    referencedBy.getMetadata(),
1✔
114
                    Utils.wrapReferenceValueAt(Utils.wrapWithPrefix(key, Consts.SET_KEY_PREFIX), referencedBy.getAtTx())
1✔
115
            );
116
        }
117

118
        return kv.digestFor(version);
1✔
119
    }
120

121
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc