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

nats-io / nats.java / #1947

17 Apr 2025 05:31PM UTC coverage: 95.637% (+0.01%) from 95.626%
#1947

push

github

web-flow
Merge pull request #1305 from nats-io/api-stats-missed-long

Update account AccountTier with reserved memory and reserved storage

6 of 8 new or added lines in 2 files covered. (75.0%)

4 existing lines in 2 files now uncovered.

11639 of 12170 relevant lines covered (95.64%)

0.96 hits per line

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

90.0
/src/main/java/io/nats/client/api/AccountTier.java
1
// Copyright 2020 The NATS Authors
2
// Licensed under the Apache License, Version 2.0 (the "License");
3
// you may not use this file except in compliance with the License.
4
// You may obtain a copy of the License at:
5
//
6
// http://www.apache.org/licenses/LICENSE-2.0
7
//
8
// Unless required by applicable law or agreed to in writing, software
9
// distributed under the License is distributed on an "AS IS" BASIS,
10
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
// See the License for the specific language governing permissions and
12
// limitations under the License.
13

14
package io.nats.client.api;
15

16
import io.nats.client.support.JsonValue;
17

18
import static io.nats.client.support.ApiConstants.*;
19
import static io.nats.client.support.JsonValueUtils.readInteger;
20
import static io.nats.client.support.JsonValueUtils.readObject;
21

22
/**
23
 * Represents the JetStream Account Tier
24
 */
25
public class AccountTier {
26

27
    private final long memory;
28
    private final long storage;
29
    private final long reservedMemory;
30
    private final long reservedStorage;
31
    private final int streams;
32
    private final int consumers;
33
    private final AccountLimits limits;
34

35
    AccountTier(JsonValue vAccountTier) {
1✔
36
        memory = readInteger(vAccountTier, MEMORY, 0);
1✔
37
        storage = readInteger(vAccountTier, STORAGE, 0);
1✔
38
        reservedMemory = readInteger(vAccountTier, RESERVED_MEMORY, 0);
1✔
39
        reservedStorage = readInteger(vAccountTier, RESERVED_STORAGE, 0);
1✔
40
        streams = readInteger(vAccountTier, STREAMS, 0);
1✔
41
        consumers = readInteger(vAccountTier, CONSUMERS, 0);
1✔
42
        limits = new AccountLimits(readObject(vAccountTier, LIMITS));
1✔
43
    }
1✔
44

45
    /**
46
     * Memory Storage being used for Stream Message storage in this tier.
47
     * @return the memory storage in bytes
48
     */
49
    public long getMemoryBytes() {
50
        return memory;
1✔
51
    }
52

53
    /**
54
     * File Storage being used for Stream Message storage in this tier.
55
     * @return the storage in bytes
56
     */
57
    public long getStorageBytes() {
58
        return storage;
1✔
59
    }
60

61
    /**
62
     * Bytes that is reserved for memory usage by this account on the server
63
     * @return the memory usage in bytes
64
     */
65
    public long getReservedMemory() {
66
        return (int)reservedMemory;
1✔
67
    }
68

69
    /**
70
     * Bytes that is reserved for disk usage by this account on the server
71
     * @return the disk usage in bytes
72
     */
73
    public long getReservedStorage() {
74
        return reservedStorage;
1✔
75
    }
76

77
    /**
78
     * Bytes that is reserved for memory usage by this account on the server
79
     * @return the memory usage in bytes
80
     */
81
    public long getReservedMemoryBytes() {
UNCOV
82
        return reservedMemory;
×
83
    }
84

85
    /**
86
     * Bytes that is reserved for disk usage by this account on the server
87
     * @return the disk usage in bytes
88
     */
89
    public long getReservedStorageBytes() {
UNCOV
90
        return reservedStorage;
×
91
    }
92

93
    /**
94
     * Number of active streams in this tier.
95
     * @return the number of streams
96
     */
97
    public int getStreams() {
98
        return streams;
1✔
99
    }
100

101
    /**
102
     * Number of active consumers in this tier.
103
     * @return the number of consumers
104
     */
105
    public int getConsumers() {
106
        return consumers;
1✔
107
    }
108

109
    /**
110
     * The limits of this tier.
111
     * @return the limits object
112
     */
113
    public AccountLimits getLimits() {
114
        return limits;
1✔
115
    }
116

117
    /**
118
     * @deprecated use getMemoryBytes instead
119
     * Memory Storage being used for Stream Message storage in this tier.
120
     * @return the memory storage in bytes
121
     */
122
    @Deprecated
123
    public int getMemory() {
124
        return (int)memory;
1✔
125
    }
126

127
    /**
128
     * @deprecated use getStorageBytes instead
129
     * File Storage being used for Stream Message storage in this tier.
130
     * @return the storage in bytes
131
     */
132
    @Deprecated
133
    public int getStorage() {
134
        return (int)storage;
1✔
135
    }
136
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc