Skip to content

Commit eb340ed

Browse files
committed
Code liniting
1 parent fd148e8 commit eb340ed

11 files changed

Lines changed: 70 additions & 72 deletions

src/main/java/picoded/dstack/FileWorkspaceMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ default FileWorkspace[] getArrayFromID(String[] idArray, boolean isUnchecked) {
125125
**/
126126
@Override
127127
void clear();
128-
128+
129129
/**
130130
* Return the current list of ID keys for fileWorkspaceMap
131131
**/

src/main/java/picoded/dstack/file/layered/FileLayered_FileWorkspaceMap.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,38 +77,38 @@ public Set<String> keySet() {
7777
// For each one of it, process it!
7878
for (File l1_dir : l1_dirList) {
7979
// Skip if its not a directory
80-
if( !l1_dir.isDirectory() ) {
80+
if (!l1_dir.isDirectory()) {
8181
continue;
8282
}
83-
83+
8484
// List all the files/folders
8585
File[] l2_dirList = l1_dir.listFiles();
8686

87-
for(File l2_dir : l2_dirList) {
87+
for (File l2_dir : l2_dirList) {
8888
// Skip if its not a directory
89-
if( !l2_dir.isDirectory() ) {
89+
if (!l2_dir.isDirectory()) {
9090
continue;
9191
}
92-
92+
9393
// Get the oidDirLIst
9494
File[] oid_list = l2_dir.listFiles();
95-
95+
9696
// For each oid dir
97-
for(File oid_dir : oid_list) {
97+
for (File oid_dir : oid_list) {
9898
// Get the presumed oid
9999
String oid = oid_dir.getName();
100-
100+
101101
// Validate the dir name (oid)
102-
if( !validateOid(oid) ) {
102+
if (!validateOid(oid)) {
103103
continue;
104104
}
105-
105+
106106
// Add the oid to the ret set
107107
ret.add(oid);
108108
}
109109
}
110110
}
111-
111+
112112
// Return the full keyset
113113
return ret;
114114
}

src/main/java/picoded/dstack/file/simple/FileSimple_FileWorkspaceMap.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -651,22 +651,22 @@ public Set<String> keySet() {
651651
// For each one of it, process it!
652652
for (File subFile : dirList) {
653653
// Skip if its not a directory
654-
if( !subFile.isDirectory() ) {
654+
if (!subFile.isDirectory()) {
655655
continue;
656656
}
657-
657+
658658
// Get the presumed oid
659659
String oid = subFile.getName();
660-
660+
661661
// Validate the dir name (oid)
662-
if( !validateOid(oid) ) {
662+
if (!validateOid(oid)) {
663663
continue;
664664
}
665-
665+
666666
// Add the oid to the ret set
667667
ret.add(oid);
668668
}
669-
669+
670670
// Return the full keyset
671671
return ret;
672672
}

src/main/java/picoded/dstack/jsql/JSql_FileWorkspaceMap.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ public Set<String> keySet() {
672672
}
673673
return ListValueConv.toStringSet(r.getObjectList("oID"));
674674
}
675-
675+
676676
/**
677677
* Gets and return a random object ID
678678
*
@@ -691,5 +691,4 @@ public String randomObjectID() {
691691
return r.getStringArray("oID")[0];
692692
}
693693

694-
695694
}

src/main/java/picoded/dstack/mongodb/MongoDBStack.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ public static String getFullConnectionURL(GenericConvertMap<String, Object> conf
5959
int port = config.getInt("port", 27017);
6060
String opts = config.getString("opt_str", "w=majority&retryWrites=true&retryReads=true"
6161
+ "&maxPoolSize=10&compressors=zstd");
62-
// "&readPreference=nearest&readConcernLevel=linearizable"
62+
// "&readPreference=nearest&readConcernLevel=linearizable"
6363

6464
// Lets do a logging, for missing read concern if its not configured
65-
if( opts.indexOf("readConcernLevel") < 0 ) {
65+
if (opts.indexOf("readConcernLevel") < 0) {
6666
//
6767
// readConcernLevel is a complicated topic, do consider reading up
6868
// https://jepsen.io/analyses/mongodb-4.2.6
@@ -74,11 +74,11 @@ public static String getFullConnectionURL(GenericConvertMap<String, Object> conf
7474
// Unless you know what your doing from a performance standpoint, it is strongly recommended to use
7575
// `readConcernLevel=linearizable`
7676
//
77-
LOGGER.warning("MongoDB is configured without readConcernLevel, "+
78-
"this is alright for a single node, but `readConcernLevel=linearizable`"+
79-
"is highly recommended for replica clusters to ensure read after write consistency.");
77+
LOGGER.warning("MongoDB is configured without readConcernLevel, "
78+
+ "this is alright for a single node, but `readConcernLevel=linearizable`"
79+
+ "is highly recommended for replica clusters to ensure read after write consistency.");
8080
}
81-
81+
8282
// In the future we may want to support opt_map
8383
// GenericConvertMap<String,Object> optMap = config.getGenericConvertStringMap("opt_map", "{}");
8484

src/main/java/picoded/dstack/mongodb/MongoDB_DataObjectMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public Set<String> keySet() {
294294

295295
// Lets fetch everything ... D=
296296
DistinctIterable<String> search = collection.distinct("_oid", String.class);
297-
297+
298298
// Lets iterate the search
299299
try (MongoCursor<String> cursor = search.iterator()) {
300300
while (cursor.hasNext()) {

src/main/java/picoded/dstack/mongodb/MongoDB_FileWorkspaceMap.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ public Set<String> keySet() {
908908

909909
// Lets fetch everything ... D=
910910
DistinctIterable<String> search = filesCollection.distinct("metadata.oid", String.class);
911-
911+
912912
// Lets iterate the search
913913
try (MongoCursor<String> cursor = search.iterator()) {
914914
while (cursor.hasNext()) {
@@ -920,5 +920,4 @@ public Set<String> keySet() {
920920
return ret;
921921
}
922922

923-
924923
}

src/main/java/picoded/dstack/redisson/Redisson_DataObjectMap.java

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,14 @@ public void clear() {
137137
//Delete all the keys of all the existing databases
138138
redisson.getKeys().flushall();
139139
}
140-
140+
141141
/**
142142
* Teardown and delete the backend storage table, etc. If needed
143143
**/
144144
public void systemDestroy() {
145145
redisMap.delete();
146146
}
147-
147+
148148
/**
149149
* [Internal use, to be extended in future implementation]
150150
*
@@ -168,51 +168,54 @@ public void DataObjectRemoteDataMap_update(String _oid, Map<String, Object> full
168168
Set<String> updateKeys) {
169169

170170
Map<String, Object> clonedMap = new HashMap<String, Object>();
171-
171+
172172
// Lets iterate the keys, and decide accordingly
173173
for (String key : fullMap.keySet()) {
174174
// Get the full map value
175175
Object val = fullMap.get(key);
176-
176+
177177
if (updateKeys.contains(key)) {
178178
clonedMap.put(key, val);
179179
}
180180
}
181-
181+
182182
// call the default implementation, basically equal to redisMap.put(_oid,clonedMap)
183183
super.DataObjectRemoteDataMap_update(_oid, clonedMap, updateKeys);
184184
}
185-
186-
public Map<String,Object> ObjToMap(Object obj) {
187-
if( obj instanceof Map ) { return (Map<String,Object>) obj; }
188-
else {return null;}
185+
186+
public Map<String, Object> ObjToMap(Object obj) {
187+
if (obj instanceof Map) {
188+
return (Map<String, Object>) obj;
189+
} else {
190+
return null;
191+
}
189192
}
190193

191194
/**
192195
* Gets the complete remote data map, for DataObject.
193196
* @return null if not exists, else a map with the data
194197
**/
195198
public Map<String, Object> DataObjectRemoteDataMap_get(String _oid) {
196-
199+
197200
//Map Slicing
198201
Set<String> keys = new HashSet<String>();
199202
Map<String, Object> mapSlice = new HashMap<String, Object>();
200-
Map.Entry<String,Object> res = null;
203+
Map.Entry<String, Object> res = null;
201204
Object tmpObj = null;
202-
205+
203206
keys.add(_oid);
204207
mapSlice = redisMap.getAll(keys);
205208

206-
Iterator<Map.Entry<String,Object>> it = mapSlice.entrySet().iterator();
207-
if(it.hasNext()){
209+
Iterator<Map.Entry<String, Object>> it = mapSlice.entrySet().iterator();
210+
if (it.hasNext()) {
208211
res = it.next();
209212
tmpObj = res.getValue();
210213
}
211-
214+
212215
if (tmpObj == null) {
213216
return null;
214217
}
215-
218+
216219
Map<String, Object> resObj = null;
217220
resObj = ObjToMap(tmpObj);
218221

@@ -221,14 +224,14 @@ public Map<String, Object> DataObjectRemoteDataMap_get(String _oid) {
221224
// Lets iterate through the object
222225
Set<String> fullKeys = resObj.keySet();
223226
for (String key : fullKeys) {
224-
227+
225228
// Get the value
226229
Object val = resObj.get(key);
227-
230+
228231
// Populate the ret map
229232
ret.put(key, val);
230233
}
231-
234+
232235
return ret;
233236
}
234237

src/main/java/picoded/dstack/redisson/Redisson_KeyValueMap.java

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ private String name() {
9090
* @return backendmap memoizer
9191
*/
9292
// private RMap<String, Map<String, Object>> _backendRMap = null;
93-
private RMapCache<String, String> _backendRMap = null;
93+
private RMapCache<String, String> _backendRMap = null;
9494

9595
/**
9696
* @return Storage map used for the backend operations of one "DataObjectMap"
@@ -164,10 +164,10 @@ public void maintenance() {
164164
public Set<String> keySet(String value) {
165165
// The return hashset
166166
HashSet<String> ret = new HashSet<String>();
167-
List<String> retList = null;
168-
if (value == null) {
167+
List<String> retList = null;
168+
if (value == null) {
169169
// Lets fetch everything
170-
retList = new ArrayList<String>(backendMap().readAllKeySet());
170+
retList = new ArrayList<String>(backendMap().readAllKeySet());
171171
// Return the full keyset
172172
retList.forEach(k -> ret.add(k));
173173
} else {
@@ -202,14 +202,12 @@ public Set<String> keySet(String value) {
202202
**/
203203
public void setExpiryRaw(String key, long time) {
204204
if (time > 0) {
205-
backendMap()
206-
.updateEntryExpiration(key, Math.max(time - System.currentTimeMillis(), 1),
207-
TimeUnit.MILLISECONDS,0,TimeUnit.MILLISECONDS);
205+
backendMap().updateEntryExpiration(key, Math.max(time - System.currentTimeMillis(), 1),
206+
TimeUnit.MILLISECONDS, 0, TimeUnit.MILLISECONDS);
208207
} else {
209208
backendMap()
210-
.updateEntryExpiration(key, 0,
211-
TimeUnit.MILLISECONDS,0,TimeUnit.MILLISECONDS);
212-
}
209+
.updateEntryExpiration(key, 0, TimeUnit.MILLISECONDS, 0, TimeUnit.MILLISECONDS);
210+
}
213211
}
214212

215213
/**
@@ -254,28 +252,28 @@ public String setValueRaw(String key, String value, long expire) {
254252
* @return String value, and expiry pair
255253
**/
256254
public MutablePair<String, Long> getValueExpiryRaw(String key, long now) {
257-
255+
258256
Set<String> keys = new HashSet<String>();
259257
Map<String, String> mapSlice = new HashMap<String, String>();
260-
Map.Entry<String,String> entry = null;
261-
258+
Map.Entry<String, String> entry = null;
259+
262260
keys.add(key);
263261
mapSlice = backendMap().getAll(keys);
264-
265-
Iterator<Map.Entry<String,String>> it = mapSlice.entrySet().iterator();
266-
if(it.hasNext()){
262+
263+
Iterator<Map.Entry<String, String>> it = mapSlice.entrySet().iterator();
264+
if (it.hasNext()) {
267265
entry = it.next();
268266
if (entry == null) {
269267
return null;
270268
}
271269
String value = entry.getValue();
272-
270+
273271
// Get the raw TTL
274272
long rawTTL = backendMap().remainTimeToLive(key);
275-
if( rawTTL <= -2 ) {
273+
if (rawTTL <= -2) {
276274
// value has expired
277275
return null;
278-
} else if( rawTTL <= -1 ) {
276+
} else if (rawTTL <= -1) {
279277
// has no expiry
280278
// Note: 0 = no timestamp, hence valid value
281279
return new MutablePair<String, Long>(value, 0L);

src/main/java/picoded/dstack/struct/simple/StructSimple_FileWorkspaceMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ public Set<String> backend_getFileAndFolderPathSet(final String oid, final Strin
627627
public Set<String> keySet() {
628628
return new HashSet<>(fileContentMap.keySet());
629629
}
630-
630+
631631
//--------------------------------------------------------------------------
632632
//
633633
// Constructor and maintenance

0 commit comments

Comments
 (0)