Search in sources :

Example 1 with RuleKey

use of com.facebook.buck.artifact_cache.thrift.RuleKey in project buck by facebook.

the class HybridPayloadGenerator method createFetchRequest.

private BuckCacheRequest createFetchRequest() {
    BuckCacheFetchRequest fetchRequest = new BuckCacheFetchRequest();
    RuleKey ruleKey = new RuleKey();
    ruleKey.setHashString(STORE_RULE_KEY_ONE);
    fetchRequest.setRuleKey(ruleKey);
    BuckCacheRequest cacheRequest = new BuckCacheRequest();
    cacheRequest.setType(BuckCacheRequestType.FETCH);
    cacheRequest.setFetchRequest(fetchRequest);
    cacheRequest.setType(BuckCacheRequestType.FETCH);
    return cacheRequest;
}
Also used : RuleKey(com.facebook.buck.artifact_cache.thrift.RuleKey) BuckCacheRequest(com.facebook.buck.artifact_cache.thrift.BuckCacheRequest) BuckCacheFetchRequest(com.facebook.buck.artifact_cache.thrift.BuckCacheFetchRequest)

Example 2 with RuleKey

use of com.facebook.buck.artifact_cache.thrift.RuleKey in project buck by facebook.

the class HybridPayloadGenerator method createStoreRequest.

private BuckCacheRequest createStoreRequest() {
    BuckCacheRequest cacheRequest = new BuckCacheRequest();
    cacheRequest.setType(BuckCacheRequestType.STORE);
    BuckCacheStoreRequest storeRequest = new BuckCacheStoreRequest();
    ArtifactMetadata metadata = new ArtifactMetadata();
    RuleKey ruleKeyOne = new RuleKey();
    ruleKeyOne.setHashString(STORE_RULE_KEY_ONE);
    RuleKey ruleKeyTwo = new RuleKey();
    ruleKeyTwo.setHashString(STORE_RULE_KEY_TWO);
    List<RuleKey> ruleKeys = new ArrayList<>();
    ruleKeys.add(ruleKeyOne);
    ruleKeys.add(ruleKeyTwo);
    metadata.setRuleKeys(ruleKeys);
    Map<String, String> metadataMap = new HashMap<>();
    metadataMap.put(METDATA_KEY_ONE, METDATA_VALUE_ONE);
    metadataMap.put(METDATA_KEY_TWO, METDATA_VALUE_TWO);
    metadata.setRuleKeys(ruleKeys);
    metadata.setMetadata(metadataMap);
    List<PayloadInfo> payloadInfos = new ArrayList<>();
    PayloadInfo payloadInfo = new PayloadInfo();
    payloadInfo.setSizeBytes(PAYLOAD_ONE_BYTES.length);
    payloadInfos.add(payloadInfo);
    storeRequest.setMetadata(metadata);
    cacheRequest.setStoreRequest(storeRequest);
    cacheRequest.setPayloads(payloadInfos);
    return cacheRequest;
}
Also used : RuleKey(com.facebook.buck.artifact_cache.thrift.RuleKey) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BuckCacheStoreRequest(com.facebook.buck.artifact_cache.thrift.BuckCacheStoreRequest) BuckCacheRequest(com.facebook.buck.artifact_cache.thrift.BuckCacheRequest) PayloadInfo(com.facebook.buck.artifact_cache.thrift.PayloadInfo) ArtifactMetadata(com.facebook.buck.artifact_cache.thrift.ArtifactMetadata)

Aggregations

BuckCacheRequest (com.facebook.buck.artifact_cache.thrift.BuckCacheRequest)2 RuleKey (com.facebook.buck.artifact_cache.thrift.RuleKey)2 ArtifactMetadata (com.facebook.buck.artifact_cache.thrift.ArtifactMetadata)1 BuckCacheFetchRequest (com.facebook.buck.artifact_cache.thrift.BuckCacheFetchRequest)1 BuckCacheStoreRequest (com.facebook.buck.artifact_cache.thrift.BuckCacheStoreRequest)1 PayloadInfo (com.facebook.buck.artifact_cache.thrift.PayloadInfo)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1