Home | History | Annotate | Download | only in disk_cache
      1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // See net/disk_cache/disk_cache.h for the public interface of the cache.
      6 
      7 #ifndef NET_DISK_CACHE_FILE_BLOCK_H__
      8 #define NET_DISK_CACHE_FILE_BLOCK_H__
      9 #pragma once
     10 
     11 namespace disk_cache {
     12 
     13 // This interface exposes common functionality for a single block of data
     14 // stored on a file-block, regardless of the real type or size of the block.
     15 // Used to simplify loading / storing the block from disk.
     16 class FileBlock {
     17  public:
     18   virtual ~FileBlock() {}
     19 
     20   // Returns a pointer to the actual data.
     21   virtual void* buffer() const = 0;
     22 
     23   // Returns the size of the block;
     24   virtual size_t size() const = 0;
     25 
     26   // Returns the file offset of this block.
     27   virtual int offset() const = 0;
     28 };
     29 
     30 }  // namespace disk_cache
     31 
     32 #endif  // NET_DISK_CACHE_FILE_BLOCK_H__
     33