28
28
public class GraffitiManager {
29
29
private static final Logger LOG = LogManager .getLogger ();
30
30
static final String GRAFFITI_DIR = "graffiti" ;
31
-
32
- private final Path graffitiPath ;
31
+ private final Path directory ;
33
32
34
33
public GraffitiManager (final DataDirLayout dataDirLayout ) {
35
34
this (dataDirLayout .getValidatorDataDirectory ().resolve (GRAFFITI_DIR ));
36
35
}
37
36
38
- public GraffitiManager (final Path graffitiPath ) {
39
- this .graffitiPath = graffitiPath ;
40
- if (!graffitiPath .toFile ().exists () && !graffitiPath .toFile ().mkdirs ()) {
37
+ public GraffitiManager (final Path directory ) {
38
+ this .directory = directory ;
39
+ if (!directory .toFile ().exists () && !directory .toFile ().mkdirs ()) {
41
40
throw new IllegalStateException ("Unable to create directory for graffiti management." );
42
41
}
43
42
}
@@ -53,7 +52,7 @@ public Optional<String> setGraffiti(final BLSPublicKey publicKey, final String g
53
52
}
54
53
55
54
try {
56
- final Path file = graffitiPath .resolve (resolveFileName (publicKey ));
55
+ final Path file = directory .resolve (resolveFileName (publicKey ));
57
56
Files .writeString (file , strippedGraffiti );
58
57
} catch (IOException e ) {
59
58
final String errorMessage =
@@ -65,7 +64,7 @@ public Optional<String> setGraffiti(final BLSPublicKey publicKey, final String g
65
64
}
66
65
67
66
public Optional <String > deleteGraffiti (final BLSPublicKey publicKey ) {
68
- final Path file = graffitiPath .resolve (resolveFileName (publicKey ));
67
+ final Path file = directory .resolve (resolveFileName (publicKey ));
69
68
70
69
try {
71
70
Files .delete (file );
@@ -82,7 +81,7 @@ public Optional<String> deleteGraffiti(final BLSPublicKey publicKey) {
82
81
}
83
82
84
83
public Optional <Bytes32 > getGraffiti (final BLSPublicKey publicKey ) {
85
- final Path filePath = graffitiPath .resolve (resolveFileName (publicKey ));
84
+ final Path filePath = directory .resolve (resolveFileName (publicKey ));
86
85
if (!filePath .toFile ().exists ()) {
87
86
return Optional .empty ();
88
87
}
0 commit comments