chromium/net/tools/cachetool/cachetool.cc

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include <iostream>
#include <memory>
#include <string_view>
#include <unordered_map>

#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/containers/span.h"
#include "base/files/file_path.h"
#include "base/format_macros.h"
#include "base/hash/md5.h"
#include "base/logging.h"
#include "base/message_loop/message_pump_type.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_executor.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "net/base/io_buffer.h"
#include "net/base/test_completion_callback.h"
#include "net/disk_cache/disk_cache.h"
#include "net/disk_cache/disk_cache_test_util.h"
#include "net/http/http_cache.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_response_info.h"
#include "net/http/http_util.h"

Backend;
BackendResult;
Entry;
EntryResult;

namespace {

struct EntryData {};

constexpr int kResponseInfoIndex =;
constexpr int kResponseContentIndex =;

const char* const kCommandNames[] =;

// Prints the command line help.
void PrintHelp() {}

// Generic command input/output.
class CommandMarshal {};

// Command line input/output that is user readable.
class ProgramArgumentCommandMarshal final : public CommandMarshal {};

// Online command input/output that receives pickled commands from stdin and
// returns their results back in stdout. Send the stop command to properly exit
// cachetool's main loop.
class StreamCommandMarshal final : public CommandMarshal {};

// Gets the cache's size.
void GetSize(CommandMarshal* command_marshal) {}

// Prints all of a cache's keys to stdout.
bool ListKeys(CommandMarshal* command_marshal) {}

bool GetResponseInfoForEntry(disk_cache::Entry* entry,
                             net::HttpResponseInfo* response_info) {}

std::string GetMD5ForResponseBody(disk_cache::Entry* entry) {}

void PersistResponseInfo(CommandMarshal* command_marshal,
                         const std::string& key,
                         const net::HttpResponseInfo& response_info) {}

void ListDups(CommandMarshal* command_marshal) {}

// Gets a key's stream to a buffer.
scoped_refptr<net::GrowableIOBuffer> GetStreamForKeyBuffer(
    CommandMarshal* command_marshal,
    const std::string& key,
    int index) {}

// Prints a key's stream to stdout.
void GetStreamForKey(CommandMarshal* command_marshal) {}

// Sets stdin as the key's raw response headers.
void UpdateRawResponseHeaders(CommandMarshal* command_marshal) {}

// Sets a response header for a key.
void SetHeader(CommandMarshal* command_marshal) {}

// Deletes a specified key stream from the cache.
void DeleteStreamForKey(CommandMarshal* command_marshal) {}

// Deletes a specified key from the cache.
void DeleteKey(CommandMarshal* command_marshal) {}

// Executes all command from the |command_marshal|.
bool ExecuteCommands(CommandMarshal* command_marshal) {}

}  // namespace

int main(int argc, char* argv[]) {}