use of com.facebook.buck.artifact_cache.CacheResultType in project buck by facebook.
the class RuleKeyLoggerListener method onArtifactCacheEvent.
@Subscribe
public void onArtifactCacheEvent(HttpArtifactCacheEvent.Finished event) {
if (event.getOperation() != ArtifactCacheEvent.Operation.FETCH || !event.getCacheResult().isPresent()) {
return;
}
CacheResultType cacheResultType = event.getCacheResult().get().getType();
if (cacheResultType != CacheResultType.MISS && cacheResultType != CacheResultType.ERROR) {
return;
}
List<String> newLogLines = Lists.newArrayList();
for (RuleKey key : event.getRuleKeys()) {
newLogLines.add(toTsv(key, cacheResultType));
}
synchronized (lock) {
logLines.addAll(newLogLines);
}
flushLogLinesIfNeeded();
}
use of com.facebook.buck.artifact_cache.CacheResultType in project buck by facebook.
the class CacheCommand method cacheResultToString.
private String cacheResultToString(CacheResult cacheResult) {
CacheResultType type = cacheResult.getType();
String typeString = type.toString();
switch(type) {
case ERROR:
return String.format("%s %s", typeString, cacheResult.getCacheError());
case HIT:
return String.format("%s %s", typeString, cacheResult.getCacheSource());
case MISS:
case IGNORED:
case LOCAL_KEY_UNCHANGED_HIT:
default:
return typeString;
}
}
Aggregations