File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
cache/src/main/java/io/envoyproxy/controlplane/cache Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 44import com .google .common .hash .Hashing ;
55import com .google .protobuf .Message ;
66
7+ import java .nio .charset .StandardCharsets ;
8+
79@ AutoValue
810public abstract class VersionedResource <T extends Message > {
911
@@ -32,11 +34,15 @@ public static <T extends Message> VersionedResource<T> create(T resource) {
3234 resource ,
3335 // todo: is this a stable hash?
3436 Hashing .sha256 ()
35- .hashBytes ( resource . toByteArray () )
37+ .hashString ( resourceHashCode ( resource ), StandardCharsets . UTF_8 )
3638 .toString ()
3739 );
3840 }
3941
42+ private static <T extends Message > String resourceHashCode (T resource ) {
43+ return resource .getClass () + "@" + resource .hashCode ();
44+ }
45+
4046 /**
4147 * Returns the resource.
4248 */
You can’t perform that action at this time.
0 commit comments