Skip to content

Commit da8f898

Browse files
committed
core: Inode: Provide helper method create Inode from Opaque fileIdKey
This decouples the last bit of the remaining byte[] logic from Opaque. Related: #149 Signed-off-by: Christian Kohlschütter <[email protected]>
1 parent a957861 commit da8f898

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

core/src/main/java/org/dcache/nfs/v4/FileTracker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ void removeOpen(Inode inode, stateid4 stateid) {
565565
public Map<Inode, Collection<NFS4Client>> getOpenFiles() {
566566
return files.entrySet().stream()
567567
.collect(Collectors.toMap(
568-
e -> Inode.forFile(e.getKey().asBytes()),
568+
e -> Inode.forFileIdKey(e.getKey()),
569569
e -> e.getValue().stream().map(OpenState::getClient).collect(Collectors.toSet())));
570570
}
571571

@@ -578,7 +578,7 @@ public Map<Inode, Collection<NFS4Client>> getOpenFiles() {
578578
public Map<Inode, Collection<NFS4Client>> getDelegations() {
579579
return delegations.entrySet().stream()
580580
.collect(Collectors.toMap(
581-
e -> Inode.forFile(e.getKey().asBytes()),
581+
e -> Inode.forFileIdKey(e.getKey()),
582582
e -> e.getValue().stream().map(DelegationState::client).collect(Collectors.toSet())));
583583
}
584584
}

core/src/main/java/org/dcache/nfs/vfs/Inode.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ public static Inode forFile(byte[] bytes) {
144144
return new Inode(0, 0, 0, bytes);
145145
}
146146

147+
public static Inode forFileIdKey(Opaque key) {
148+
return forFile(key.asBytes());
149+
}
150+
147151
@Deprecated(forRemoval = true)
148152
public byte[] getFileId() {
149153
return opaqueKey.asBytes();

0 commit comments

Comments
 (0)