| // Copyright 2011 Google Inc. |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| // Author: abliss@google.com (Adam Bliss) |
| |
| // Protobuf to encapsulate custom metadata about a resource (not including real |
| // HTTP Headers). |
| |
| syntax = "proto2"; |
| |
| package net_instaweb; |
| |
| // Info about the input resource that was used to create a CachedResult. |
| // Next free tag: 10. |
| message InputInfo { |
| // Generally, URLs of inputs are not kept in the protobufs, only the indices. |
| // The intended usage is the URLs of inputs will be used to construct |
| // the key to a cache entry, and the cache value will be an |
| // encoded OutputPartitions. |
| // |
| // One caveat to this is that in case of a file-loaded input we store its |
| // filename. This is because it's otherwise too hard to determine the name |
| // when we need to do cache validation of things like nested |
| // rewrites, and to keep this information accurate across caching |
| // of such inner jobs. |
| optional int32 index = 1; |
| |
| // This type affects how we check that CachedResults are up-to-date. |
| enum Type { |
| // Cached resources are valid until the expiration_time_ms. |
| CACHED = 1; |
| // File based resources are valid as long as the file has not changed. |
| // We stat the file and compare it's mtime to last_modified_time_ms |
| // to decide if the file has changed or not. |
| FILE_BASED = 2; |
| // E.g. data: URL resources never expire or change. |
| ALWAYS_VALID = 3; |
| } |
| required Type type = 2; |
| // An identifying timestamp which can be used to decide if a resource has |
| // been updated or not. For web-based resources, we use Last-Modified headers. |
| // For file-based resources, we use mtime. |
| optional int64 last_modified_time_ms = 3; |
| |
| // For CACHED resources, keeps track of when the input expires, as taken |
| // from the headers returned when it was fetched. |
| optional int64 expiration_time_ms = 4; |
| |
| // For FILE_BASED resources, the file this was loaded from. |
| optional string filename = 5; |
| |
| // For CACHED resources, we keep track of the original fetch time so we |
| // can freshen. |
| optional int64 date_ms = 6; |
| |
| // For CACHED and FILE_BASED resources, we store a hash of the input, so |
| // that we can reuse optimization results if it did not change, even if it |
| // has expired from the HTTP cache. |
| optional string input_content_hash = 7; |
| |
| // If true, no later filters should process the same input. |
| optional bool disable_further_processing = 8; |
| |
| // To support invalidation by exact URL, we keep the URL in the metadata. |
| // This bloats the size a bit, but enables fast invalidation. Compressing |
| // the metadata cache helps. |
| optional string url = 9; |
| } |
| |