APISonar


com.facebook.buck.artifact_cache.config.ArtifactCacheMode.http

> com > facebook > buck > artifact_cache > config > ArtifactCacheMode > http
com APIs facebook APIs buck APIs artifact_cache APIs config APIs ArtifactCacheMode APIs http APIs

Example 1
public void testMode() throws IOException {
    ArtifactCacheBuckConfig config = createFromText("[cache]", "mode = http");
    assertThat(config.hasAtLeastOneWriteableCache(), Matchers.is(true));
    assertThat(config.getArtifactCacheModes(), Matchers.contains(ArtifactCacheMode.http));

    config = createFromText("[cache]", "mode = dir");
    assertThat(config.hasAtLeastOneWriteableCache(), Matchers.is(false));
    assertThat(config.getArtifactCacheModes(), Matchers.contains(ArtifactCacheMode.dir));

    config = createFromText("[cache]", "mode = dir, http");
    assertThat(config.hasAtLeastOneWriteableCache(), Matchers.is(true));
    assertThat(
        config.getArtifactCacheModes(),
        Matchers.containsInAnyOrder(ArtifactCacheMode.dir, ArtifactCacheMode.http));
  }
Example 2
public void preserveErrorsFromInnerCache() throws InterruptedException, IOException {
    ErroringArtifactCache inner = new ErroringArtifactCache();
    MultiArtifactCache cache = new MultiArtifactCache(ImmutableList.of(inner));
    CacheResult result = Futures.getUnchecked(cache.fetchAsync(dummyRuleKey, dummyFile));
    assertThat(result.cacheMode(), Matchers.equalTo(Optional.of(ArtifactCacheMode.http)));
    assertSame(result.getType(), CacheResultType.ERROR);
    cache.close();
  }
Example 3
public ListenableFuture<CacheResult> fetchAsync(
      BuildTarget target, RuleKey ruleKey, LazyPath output) {
    return Futures.immediateFuture(
        ruleKey.equals(storeKey)
            ? CacheResult.hit("cache", ArtifactCacheMode.http)
            : CacheResult.miss());
  }