sccache 0.1.0

Sccache is a ccache-like tool. It is used as a compiler wrapper and avoids compilation when possible, storing a cache in a remote storage using the S3 API.
// Copyright 2016 Mozilla Foundation
//
// 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.

package sccache;

// Get cache statistics.
message GetStats {}

// Shut down the server.
message Shutdown {}

// Run a compile command.
message Compile {
  // The directory in which to run the command.
  required string cwd = 1;
  // The executable to run.
  required string exe = 2;
  // The command line arguments.
  repeated string command = 3;
}

message ClientRequest {
  // A client request can be any one of the following:
  oneof request {
    GetStats get_stats = 1;
    Shutdown shutdown = 2;
    Compile compile = 3;
  }
}

// A single cache statistic.
message CacheStatistic {
  required string name = 1;
  oneof value {
    // A simple counter.
    uint64 count = 2;
    // A string value.
    string str = 3;
    // A size, in bytes.
    uint64 size = 4;
  }
}

// A list of cache statistics.
message CacheStats {
  repeated CacheStatistic stats = 1;
}

// The server is shutting down.
message ShuttingDown {
  required CacheStats stats = 1;
}

// The server started executing a compilation.
message CompileStarted {}

// The server ran a compile command.
message CompileFinished {
  // The return code of the process.
  oneof exit_status {
    // Normal exit.
    int32 retcode = 1;
    // Terminated by a signal.
    int32 signal = 2;
  }
  optional bytes stdout = 3;
  optional bytes stderr = 4;
}

// The server could not handle this compile command line.
message UnhandledCompile {}

// This command was unknown to the server.
message UnknownCommand {}

message ServerResponse {
  // A server response can be any one of the following:
  oneof response {
    CacheStats stats = 1;
    ShuttingDown shutting_down = 2;
    CompileStarted compile_started = 3;
    CompileFinished compile_finished = 4;
    UnhandledCompile unhandled_compile = 5;
    UnknownCommand unknown = 6;
  }
}