text:
namespace {

#if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_ANDROID) || \
    defined(OS_OPENBSD)
// The following are glibc-specific

size_t fread_unlocked(void *ptr, size_t size, size_t n, FILE *file) {
  return fread(ptr, size, n, file);
}

size_t fwrite_unlocked(const void *ptr, size_t size, size_t n, FILE *file) {
  return fwrite(ptr, size, n, file);
}

int fflush_unlocked(FILE *file) {
  return fflush(file);
}

#if !defined(OS_ANDROID)
int fdatasync(int fildes) {
#if defined(OS_WIN)
  return _commit(fildes);
#else
  return HANDLE_EINTR(fsync(fildes));
#endif
}
#endif

#endif

// Wide-char safe fopen wrapper.
FILE* fopen_internal(const char* fname, const char* mode) {
#if defined(OS_WIN)
  return _wfopen(UTF8ToUTF16(fname).c_str(), ASCIIToUTF16(mode).c_str());
#else
  return fopen(fname, mode);
#endif
}

base::FilePath CreateFilePath(const std::string& file_path) {
#if defined(OS_WIN)
  return base::FilePath(UTF8ToUTF16(file_path));
#else
  return base::FilePath(file_path);
#endif
}

std::string FilePathToString(const base::FilePath& file_path) {
#if defined(OS_WIN)
  return UTF16ToUTF8(file_path.value());
#else
  return file_path.value();
#endif
}

bool sync_parent(const std::string& fname) {
#if !defined(OS_WIN)
  TRACE_EVENT0("leveldb", "sync_parent");
  base::FilePath parent_dir = CreateFilePath(fname).DirName();
  int parent_fd =
      HANDLE_EINTR(open(FilePathToString(parent_dir).c_str(), O_RDONLY));
  if (parent_fd < 0)
    return false;
  HANDLE_EINTR(fsync(parent_fd));
  HANDLE_EINTR(close(parent_fd));
#endif
  return true;
}

enum MethodID {
  kSequentialFileRead,
  kSequentialFileSkip,
  kRandomAccessFileRead,
  kWritableFileAppend,
  kWritableFileClose,
  kWritableFileFlush,
  kWritableFileSync,
  kNewSequentialFile,
  kNewRandomAccessFile,
  kNewWritableFile,
  kDeleteFile,
  kCreateDir,
  kDeleteDir,
  kGetFileSize,
  kRenameFile,
  kLockFile,
  kUnlockFile,
  kGetTestDirectory,
  kNewLogger,
  kNumEntries
};

const char* MethodIDToString(MethodID method) {
  switch (method) {
    case kSequentialFileRead:
      return "SequentialFileRead";
    case kSequentialFileSkip:
      return "SequentialFileSkip";
    case kRandomAccessFileRead:
      return "RandomAccessFileRead";
    case kWritableFileAppend:
      return "WritableFileAppend";
    case kWritableFileClose:
      return "WritableFileClose";
    case kWritableFileFlush:
      return "WritableFileFlush";
    case kWritableFileSync:
      return "WritableFileSync";
    case kNewSequentialFile:
      return "NewSequentialFile";
    case kNewRandomAccessFile:
      return "NewRandomAccessFile";
    case kNewWritableFile:
      return "NewWritableFile";
    case kDeleteFile:
      return "DeleteFile";
    case kCreateDir:
      return "CreateDir";
    case kDeleteDir:
      return "DeleteDir";
    case kGetFileSize:
      return "GetFileSize";
    case kRenameFile:
      return "RenameFile";
    case kLockFile:
      return "LockFile";
    case kUnlockFile:
      return "UnlockFile";
    case kGetTestDirectory:
      return "GetTestDirectory";
    case kNewLogger:
      return "NewLogger";
    case kNumEntries:
      NOTREACHED();
      return "kNumEntries";
  }
  NOTREACHED();
  return "Unknown";
}

class UMALogger {
 public:
  virtual void RecordErrorAt(MethodID method) const = 0;
  virtual void RecordOSError(MethodID method, int saved_errno) const = 0;
  virtual void RecordOSError(MethodID method, base::PlatformFileError error)
      const = 0;
};

}  // namespace

namespace leveldb {

namespace {

class Thread;

static const base::FilePath::CharType kLevelDBTestDirectoryPrefix[]
    = FILE_PATH_LITERAL("leveldb-test-");

const char* PlatformFileErrorString(const ::base::PlatformFileError& error) {
  switch (error) {
    case ::base::PLATFORM_FILE_ERROR_FAILED:
      return "Opening file failed.";
    case ::base::PLATFORM_FILE_ERROR_IN_USE:
      return "File currently in use.";
    case ::base::PLATFORM_FILE_ERROR_EXISTS:
      return "File already exists.";
    case ::base::PLATFORM_FILE_ERROR_NOT_FOUND:
      return "File not found.";
    case ::base::PLATFORM_FILE_ERROR_ACCESS_DENIED:
      return "Access denied.";
    case ::base::PLATFORM_FILE_ERROR_TOO_MANY_OPENED:
      return "Too many files open.";
    case ::base::PLATFORM_FILE_ERROR_NO_MEMORY:
      return "Out of memory.";
    case ::base::PLATFORM_FILE_ERROR_NO_SPACE:
      return "No space left on drive.";
    case ::base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY:
      return "Not a directory.";
    case ::base::PLATFORM_FILE_ERROR_INVALID_OPERATION:
      return "Invalid operation.";
    case ::base::PLATFORM_FILE_ERROR_SECURITY:
      return "Security error.";
    case ::base::PLATFORM_FILE_ERROR_ABORT:
      return "File operation aborted.";
    case ::base::PLATFORM_FILE_ERROR_NOT_A_FILE:
      return "The supplied path was not a file.";
    case ::base::PLATFORM_FILE_ERROR_NOT_EMPTY:
      return "The file was not empty.";
    case ::base::PLATFORM_FILE_ERROR_INVALID_URL:
      return "Invalid URL.";
    case ::base::PLATFORM_FILE_OK:
      return "OK.";
    case ::base::PLATFORM_FILE_ERROR_MAX:
      NOTREACHED();
  }
  NOTIMPLEMENTED();
  return "Unknown error.";
}

class ChromiumSequentialFile: public SequentialFile {
 private:
  std::string filename_;
  FILE* file_;
  const UMALogger* uma_logger_;

 public:
  ChromiumSequentialFile(const std::string& fname, FILE* f,
                         const UMALogger* uma_logger)
      : filename_(fname), file_(f), uma_logger_(uma_logger) { }
  virtual ~ChromiumSequentialFile() { fclose(file_); }

  virtual Status Read(size_t n, Slice* result, char* scratch) {
    Status s;
    size_t r = fread_unlocked(scratch, 1, n, file_);
    *result = Slice(scratch, r);
    if (r < n) {
      if (feof(file_)) {
        // We leave status as ok if we hit the end of the file
      } else {
        // A partial read with an error: return a non-ok status
        s = Status::IOError(filename_, strerror(errno));
        uma_logger_->RecordErrorAt(kSequentialFileRead);
      }
    }
    return s;
  }

  virtual Status Skip(uint64_t n) {
    if (fseek(file_, n, SEEK_CUR)) {
      uma_logger_->RecordErrorAt(kSequentialFileSkip);
      return Status::IOError(filename_, strerror(errno));
    }
    return Status::OK();
  }
};

class ChromiumRandomAccessFile: public RandomAccessFile {
 private:
  std::string filename_;
  ::base::PlatformFile file_;
  const UMALogger* uma_logger_;

 public:
  ChromiumRandomAccessFile(const std::string& fname, ::base::PlatformFile file,
                           const UMALogger* uma_logger)
      : filename_(fname), file_(file), uma_logger_(uma_logger) { }
  virtual ~ChromiumRandomAccessFile() { ::base::ClosePlatformFile(file_); }

  virtual Status Read(uint64_t offset, size_t n, Slice* result,
                      char* scratch) const {
    Status s;
    int r = ::base::ReadPlatformFile(file_, offset, scratch, n);
    *result = Slice(scratch, (r < 0) ? 0 : r);
    if (r < 0) {
      // An error: return a non-ok status
      s = Status::IOError(filename_, "Could not perform read");
      uma_logger_->RecordErrorAt(kRandomAccessFileRead);
    }
    return s;
  }
};

class ChromiumWritableFile : public WritableFile {
 private:
  std::string filename_;
  FILE* file_;
  const UMALogger* uma_logger_;

 public:
  ChromiumWritableFile(const std::string& fname, FILE* f,
                       const UMALogger* uma_logger)
      : filename_(fname), file_(f), uma_logger_(uma_logger) { }

  ~ChromiumWritableFile() {
    if (file_ != NULL) {
      // Ignoring any potential errors
      fclose(file_);
    }
  }

  virtual Status Append(const Slice& data) {
    size_t r = fwrite_unlocked(data.data(), 1, data.size(), file_);
    Status result;
    if (r != data.size()) {
      uma_logger_->RecordOSError(kWritableFileAppend, errno);
      result = Status::IOError(filename_, strerror(errno));
    }
    return result;
  }

  virtual Status Close() {
    Status result;
    if (fclose(file_) != 0) {
      result = Status::IOError(filename_, strerror(errno));
      uma_logger_->RecordErrorAt(kWritableFileClose);
    }
    file_ = NULL;
    return result;
  }

  virtual Status Flush() {
    Status result;
    if (HANDLE_EINTR(fflush_unlocked(file_))) {
      int saved_errno = errno;
      result = Status::IOError(filename_, strerror(saved_errno));
      uma_logger_->RecordOSError(kWritableFileFlush, saved_errno);
    }
    return result;
  }

  virtual Status Sync() {
    TRACE_EVENT0("leveldb", "ChromiumEnv::Sync");
    Status result;
    int error = 0;

    if (HANDLE_EINTR(fflush_unlocked(file_)))
      error = errno;
    // Sync even if fflush gave an error; perhaps the data actually got out,
    // even though something went wrong.
    if (fdatasync(fileno(file_)) && !error)
      error = errno;
    // Report the first error we found.
    if (error) {
      result = Status::IOError(filename_, strerror(error));
      uma_logger_->RecordErrorAt(kWritableFileSync);
    }
    return result;
  }
};

class ChromiumFileLock : public FileLock {
 public:
  ::base::PlatformFile file_;
};

class ChromiumEnv : public Env, public UMALogger {
 public:
  ChromiumEnv();
  virtual ~ChromiumEnv() {
    NOTREACHED();
  }

  virtual Status NewSequentialFile(const std::string& fname,
                                   SequentialFile** result) {
    FILE* f = fopen_internal(fname.c_str(), "rb");
    if (f == NULL) {
      *result = NULL;
      int saved_errno = errno;
      RecordOSError(kNewSequentialFile, saved_errno);
      return Status::IOError(fname, strerror(saved_errno));
    } else {
      *result = new ChromiumSequentialFile(fname, f, this);
      return Status::OK();
    }
  }

  virtual Status NewRandomAccessFile(const std::string& fname,
                                     RandomAccessFile** result) {
    int flags = ::base::PLATFORM_FILE_READ | ::base::PLATFORM_FILE_OPEN;
    bool created;
    ::base::PlatformFileError error_code;
    ::base::PlatformFile file = ::base::CreatePlatformFile(
        CreateFilePath(fname), flags, &created, &error_code);
    if (error_code != ::base::PLATFORM_FILE_OK) {
      *result = NULL;
      RecordOSError(kNewRandomAccessFile, error_code);
      return Status::IOError(fname, PlatformFileErrorString(error_code));
    }
    *result = new ChromiumRandomAccessFile(fname, file, this);
    return Status::OK();
  }

  virtual Status NewWritableFile(const std::string& fname,
                                 WritableFile** result) {
    *result = NULL;
    FILE* f = fopen_internal(fname.c_str(), "wb");
    if (f == NULL) {
      RecordErrorAt(kNewWritableFile);
      return Status::IOError(fname, strerror(errno));
    } else {
      if (!sync_parent(fname)) {
        fclose(f);
        RecordErrorAt(kNewWritableFile);
        return Status::IOError(fname, strerror(errno));
      }
      *result = new ChromiumWritableFile(fname, f, this);
      return Status::OK();
    }
  }

  virtual bool FileExists(const std::string& fname) {
    return ::file_util::PathExists(CreateFilePath(fname));
  }

  virtual Status GetChildren(const std::string& dir,
                             std::vector<std::string>* result) {
    result->clear();
    ::file_util::FileEnumerator iter(
        CreateFilePath(dir), false, ::file_util::FileEnumerator::FILES);
    base::FilePath current = iter.Next();
    while (!current.empty()) {
      result->push_back(FilePathToString(current.BaseName()));
      current = iter.Next();
    }
    // TODO(jorlow): Unfortunately, the FileEnumerator swallows errors, so
    //               we'll always return OK. Maybe manually check for error
    //               conditions like the file not existing?
    return Status::OK();
  }

  virtual Status DeleteFile(const std::string& fname) {
    Status result;
    // TODO(jorlow): Should we assert this is a file?
    if (!::file_util::Delete(CreateFilePath(fname), false)) {
      result = Status::IOError(fname, "Could not delete file.");
      RecordErrorAt(kDeleteFile);
    }
    return result;
  };

  virtual Status CreateDir(const std::string& name) {
    Status result;
    if (!::file_util::CreateDirectory(CreateFilePath(name))) {
      result = Status::IOError(name, "Could not create directory.");
      RecordErrorAt(kCreateDir);
    }
    return result;
  };

  virtual Status DeleteDir(const std::string& name) {
    Status result;
    // TODO(jorlow): Should we assert this is a directory?
    if (!::file_util::Delete(CreateFilePath(name), false)) {
      result = Status::IOError(name, "Could not delete directory.");
      RecordErrorAt(kDeleteDir);
    }
    return result;
  };

  virtual Status GetFileSize(const std::string& fname, uint64_t* size) {
    Status s;
    int64_t signed_size;
    if (!::file_util::GetFileSize(CreateFilePath(fname), &signed_size)) {
      *size = 0;
      s = Status::IOError(fname, "Could not determine file size.");
      RecordErrorAt(kGetFileSize);
    } else {
      *size = static_cast<uint64_t>(signed_size);
    }
    return s;
  }

  class Retrier {
   public:
    Retrier(base::HistogramBase* histogram, const int kMaxRetryMillis) :
        start_(base::TimeTicks::Now()),
        limit_(start_ + base::TimeDelta::FromMilliseconds(kMaxRetryMillis)),
        last_(start_),
        time_to_sleep_(base::TimeDelta::FromMilliseconds(10)),
        success_(true),
        histogram_(histogram) {
    }
    ~Retrier() {
      if (success_)
        histogram_->AddTime(last_ - start_);
    }
    bool ShouldKeepTrying() {
      if (last_ < limit_) {
        base::PlatformThread::Sleep(time_to_sleep_);
        last_ = base::TimeTicks::Now();
        return true;
      }
      success_ = false;
      return false;
    }
   private:
    base::TimeTicks start_;
    base::TimeTicks limit_;
    base::TimeTicks last_;
    base::TimeDelta time_to_sleep_;
    bool success_;
    base::HistogramBase* histogram_;
  };

  virtual Status RenameFile(const std::string& src, const std::string& dst) {
    Status result;
    base::FilePath src_file_path = CreateFilePath(src);
    if (!::file_util::PathExists(src_file_path))
      return result;
    base::FilePath destination = CreateFilePath(dst);

    Retrier retrier(GetRetryTimeHistogram(kRenameFile), kMaxRenameTimeMillis);
    do {
      if (::file_util::ReplaceFile(src_file_path, destination)) {
        sync_parent(dst);
        if (src != dst)
          sync_parent(src);
        return result;
      }
    } while (retrier.ShouldKeepTrying());

    RecordErrorAt(kRenameFile);
    return Status::IOError(src, "Could not rename file.");
  }

  virtual Status LockFile(const std::string& fname, FileLock** lock) {
    *lock = NULL;
    Status result;
    int flags = ::base::PLATFORM_FILE_OPEN_ALWAYS |
                ::base::PLATFORM_FILE_READ |
                ::base::PLATFORM_FILE_WRITE |
                ::base::PLATFORM_FILE_EXCLUSIVE_READ |
                ::base::PLATFORM_FILE_EXCLUSIVE_WRITE;
    bool created;
    ::base::PlatformFileError error_code;
    ::base::PlatformFile file;
    Retrier retrier(GetRetryTimeHistogram(kLockFile), kMaxRenameTimeMillis);
    do {
      file = ::base::CreatePlatformFile(
          CreateFilePath(fname), flags, &created, &error_code);
    } while (error_code != ::base::PLATFORM_FILE_OK &&
             retrier.ShouldKeepTrying());

    if (error_code != ::base::PLATFORM_FILE_OK) {
      result = Status::IOError(fname, PlatformFileErrorString(error_code));
      RecordOSError(kLockFile, error_code);
    } else {
      ChromiumFileLock* my_lock = new ChromiumFileLock;
      my_lock->file_ = file;
      *lock = my_lock;
    }
    return result;
  }

  virtual Status UnlockFile(FileLock* lock) {
    ChromiumFileLock* my_lock = reinterpret_cast<ChromiumFileLock*>(lock);
    Status result;
    if (!::base::ClosePlatformFile(my_lock->file_)) {
      result = Status::IOError("Could not close lock file.");
      RecordErrorAt(kUnlockFile);
    }
    delete my_lock;
    return result;
  }

  virtual void Schedule(void (*function)(void*), void* arg);

  virtual void StartThread(void (*function)(void* arg), void* arg);

  virtual std::string UserIdentifier() {
#if defined(OS_WIN)
    std::wstring user_sid;
    bool ret = ::base::win::GetUserSidString(&user_sid);
    DCHECK(ret);
    return UTF16ToUTF8(user_sid);
#else
    char buf[100];
    snprintf(buf, sizeof(buf), "%d", int(geteuid()));
    return buf;
#endif
  }

  virtual Status GetTestDirectory(std::string* path) {
    mu_.Acquire();
    if (test_directory_.empty()) {
      if (!::file_util::CreateNewTempDirectory(kLevelDBTestDirectoryPrefix,
                                               &test_directory_)) {
        mu_.Release();
        RecordErrorAt(kGetTestDirectory);
        return Status::IOError("Could not create temp directory.");
      }
    }
    *path = FilePathToString(test_directory_);
    mu_.Release();
    return Status::OK();
  }

  virtual Status NewLogger(const std::string& fname, Logger** result) {
    FILE* f = fopen_internal(fname.c_str(), "w");
    if (f == NULL) {
      *result = NULL;
      int saved_errno = errno;
      RecordOSError(kNewLogger, saved_errno);
      return Status::IOError(fname, strerror(saved_errno));
    } else {
      if (!sync_parent(fname)) {
        fclose(f);
        return Status::IOError(fname, strerror(errno));
      }
      *result = new ChromiumLogger(f);
      return Status::OK();
    }
  }

  virtual uint64_t NowMicros() {
    return ::base::TimeTicks::Now().ToInternalValue();
  }

  virtual void SleepForMicroseconds(int micros) {
    // Round up to the next millisecond.
    ::base::PlatformThread::Sleep(::base::TimeDelta::FromMicroseconds(micros));
  }

  void RecordErrorAt(MethodID method) const {
    GetMethodIOErrorHistogram()->Add(method);
  }

  void RecordOSError(MethodID method, base::PlatformFileError error) const {
    DCHECK(error < 0);
    RecordErrorAt(method);
    GetOSErrorHistogram(method, -base::PLATFORM_FILE_ERROR_MAX)->
        Add(-error);
  }

  void RecordOSError(MethodID method, int error) const {
    DCHECK(error > 0);
    RecordErrorAt(method);
    GetOSErrorHistogram(method, ERANGE + 1)->Add(error);
  }

 protected:
  std::string name_;

 private:
  const int kMaxRenameTimeMillis;
  // BGThread() is the body of the background thread
  void BGThread();
  static void BGThreadWrapper(void* arg) {
    reinterpret_cast<ChromiumEnv*>(arg)->BGThread();
  }

  base::HistogramBase* GetOSErrorHistogram(MethodID method, int limit) const;
  base::HistogramBase* GetRetryTimeHistogram(MethodID method) const;
  base::HistogramBase* GetMethodIOErrorHistogram() const;
  base::FilePath test_directory_;

  size_t page_size_;
  ::base::Lock mu_;
  ::base::ConditionVariable bgsignal_;
  bool started_bgthread_;

  // Entry per Schedule() call
  struct BGItem { void* arg; void (*function)(void*); };
  typedef std::deque<BGItem> BGQueue;
  BGQueue queue_;
};

ChromiumEnv::ChromiumEnv()
    : name_("LevelDBEnv"),
      page_size_(::base::SysInfo::VMAllocationGranularity()),
      bgsignal_(&mu_),
      started_bgthread_(false),
      kMaxRenameTimeMillis(1000) {
}

base::HistogramBase* ChromiumEnv::GetOSErrorHistogram(MethodID method,
                                                            int limit) const {
  std::string uma_name(name_);
  // TODO(dgrogan): This is probably not the best way to concatenate strings.
  uma_name.append(".IOError.").append(MethodIDToString(method));
  return base::LinearHistogram::FactoryGet(uma_name, 1, limit, limit + 1,
      base::Histogram::kUmaTargetedHistogramFlag);
}

base::HistogramBase* ChromiumEnv::GetRetryTimeHistogram(MethodID method) const {
  std::string uma_name(name_);
  // TODO(dgrogan): This is probably not the best way to concatenate strings.
  uma_name.append(".TimeUntilSuccessFor").append(MethodIDToString(method));

  const int kBucketSizeMillis = 25;
  // Add 2, 1 for each of the buckets <1 and >max.
  const int kNumBuckets = kMaxRenameTimeMillis / kBucketSizeMillis + 2;
  return base::Histogram::FactoryTimeGet(
      uma_name, base::TimeDelta::FromMilliseconds(1),
      base::TimeDelta::FromMilliseconds(kMaxRenameTimeMillis + 1),
      kNumBuckets,
      base::Histogram::kUmaTargetedHistogramFlag);
}

base::HistogramBase* ChromiumEnv::GetMethodIOErrorHistogram() const {
  std::string uma_name(name_);
  uma_name.append("IOError");
  return base::LinearHistogram::FactoryGet(uma_name, 1, kNumEntries,
      kNumEntries + 1, base::Histogram::kUmaTargetedHistogramFlag);
}

class Thread : public ::base::PlatformThread::Delegate {
 public:
  Thread(void (*function)(void* arg), void* arg)
      : function_(function), arg_(arg) {
    ::base::PlatformThreadHandle handle;
    bool success = ::base::PlatformThread::Create(0, this, &handle);
    DCHECK(success);
  }
  virtual ~Thread() {}
  virtual void ThreadMain() {
    (*function_)(arg_);
    delete this;
  }

 private:
  void (*function_)(void* arg);
  void* arg_;
};

void ChromiumEnv::Schedule(void (*function)(void*), void* arg) {
  mu_.Acquire();

  // Start background thread if necessary
  if (!started_bgthread_) {
    started_bgthread_ = true;
    StartThread(&ChromiumEnv::BGThreadWrapper, this);
  }

  // If the queue is currently empty, the background thread may currently be
  // waiting.
  if (queue_.empty()) {
    bgsignal_.Signal();
  }

  // Add to priority queue
  queue_.push_back(BGItem());
  queue_.back().function = function;
  queue_.back().arg = arg;

  mu_.Release();
}

void ChromiumEnv::BGThread() {
  base::PlatformThread::SetName(name_.c_str());

  while (true) {
    // Wait until there is an item that is ready to run
    mu_.Acquire();
    while (queue_.empty()) {
      bgsignal_.Wait();
    }

    void (*function)(void*) = queue_.front().function;
    void* arg = queue_.front().arg;
    queue_.pop_front();

    mu_.Release();
    TRACE_EVENT0("leveldb", "ChromiumEnv::BGThread-Task");
    (*function)(arg);
  }
}

void ChromiumEnv::StartThread(void (*function)(void* arg), void* arg) {
  new Thread(function, arg); // Will self-delete.
}

class IDBEnv : public ChromiumEnv {
 public:
  IDBEnv() : ChromiumEnv() {
    name_ = "LevelDBEnv.IDB";
  }
};

::base::LazyInstance<IDBEnv>::Leaky
    idb_env = LAZY_INSTANCE_INITIALIZER;

::base::LazyInstance<ChromiumEnv>::Leaky
    default_env = LAZY_INSTANCE_INITIALIZER;

}

Env* IDBEnv() {
  return idb_env.Pointer();
}

Env* Env::Default() {
  return default_env.Pointer();
}

}


text:
package com.nitindhar.lifesaver.data;

import com.nitindhar.lifesaver.model.Session;

public interface SessionDao {

    public boolean sessionExists();

    public boolean storeSession(Session session);

    public Session retrieveSession();

}

redpajama_set_name: RedPajamaGithub


text:
class ObjectContainerBSDArchive : public lldb_private::ObjectContainer {
public:
  ObjectContainerBSDArchive(const lldb::ModuleSP &module_sp,
                            lldb::DataBufferSP &data_sp,
                            lldb::offset_t data_offset,
                            const lldb_private::FileSpec *file,
                            lldb::offset_t offset, lldb::offset_t length);

  ~ObjectContainerBSDArchive() override;

  // Static Functions
  static void Initialize();

  static void Terminate();

  static lldb_private::ConstString GetPluginNameStatic();

  static const char *GetPluginDescriptionStatic();

  static lldb_private::ObjectContainer *
  CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
                 lldb::offset_t data_offset, const lldb_private::FileSpec *file,
                 lldb::offset_t offset, lldb::offset_t length);

  static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,
                                        lldb::DataBufferSP &data_sp,
                                        lldb::offset_t data_offset,
                                        lldb::offset_t file_offset,
                                        lldb::offset_t length,
                                        lldb_private::ModuleSpecList &specs);

  static bool MagicBytesMatch(const lldb_private::DataExtractor &data);

  // Member Functions
  bool ParseHeader() override;

  size_t GetNumObjects() const override {
    if (m_archive_sp)
      return m_archive_sp->GetNumObjects();
    return 0;
  }

  void Dump(lldb_private::Stream *s) const override;

  lldb::ObjectFileSP GetObjectFile(const lldb_private::FileSpec *file) override;

  // PluginInterface protocol
  lldb_private::ConstString GetPluginName() override;

  uint32_t GetPluginVersion() override;

protected:
  struct Object {
    Object();

    void Clear();

    lldb::offset_t Extract(const lldb_private::DataExtractor &data,
                           lldb::offset_t offset);
    /// Object name in the archive.
    lldb_private::ConstString ar_name;

    /// Object modification time in the archive.
    uint32_t modification_time;

    /// Object user id in the archive.
    uint16_t uid;

    /// Object group id in the archive.
    uint16_t gid;

    /// Object octal file permissions in the archive.
    uint16_t mode;

    /// Object size in bytes in the archive.
    uint32_t size;

    /// File offset in bytes from the beginning of the file of the object data.
    lldb::offset_t file_offset;

    /// Length of the object data.
    lldb::offset_t file_size;
  };

  class Archive {
  public:
    typedef std::shared_ptr<Archive> shared_ptr;
    typedef std::multimap<lldb_private::FileSpec, shared_ptr> Map;

    Archive(const lldb_private::ArchSpec &arch,
            const llvm::sys::TimePoint<> &mod_time, lldb::offset_t file_offset,
            lldb_private::DataExtractor &data);

    ~Archive();

    static Map &GetArchiveCache();

    static std::recursive_mutex &GetArchiveCacheMutex();

    static Archive::shared_ptr FindCachedArchive(
        const lldb_private::FileSpec &file, const lldb_private::ArchSpec &arch,
        const llvm::sys::TimePoint<> &mod_time, lldb::offset_t file_offset);

    static Archive::shared_ptr ParseAndCacheArchiveForFile(
        const lldb_private::FileSpec &file, const lldb_private::ArchSpec &arch,
        const llvm::sys::TimePoint<> &mod_time, lldb::offset_t file_offset,
        lldb_private::DataExtractor &data);

    size_t GetNumObjects() const { return m_objects.size(); }

    const Object *GetObjectAtIndex(size_t idx) {
      if (idx < m_objects.size())
        return &m_objects[idx];
      return nullptr;
    }

    size_t ParseObjects();

    Object *FindObject(lldb_private::ConstString object_name,
                       const llvm::sys::TimePoint<> &object_mod_time);

    lldb::offset_t GetFileOffset() const { return m_file_offset; }

    const llvm::sys::TimePoint<> &GetModificationTime() {
      return m_modification_time;
    }

    const lldb_private::ArchSpec &GetArchitecture() const { return m_arch; }

    void SetArchitecture(const lldb_private::ArchSpec &arch) { m_arch = arch; }

    bool HasNoExternalReferences() const;

    lldb_private::DataExtractor &GetData() { return m_data; }

  protected:
    typedef lldb_private::UniqueCStringMap<uint32_t> ObjectNameToIndexMap;
    // Member Variables
    lldb_private::ArchSpec m_arch;
    llvm::sys::TimePoint<> m_modification_time;
    lldb::offset_t m_file_offset;
    std::vector<Object> m_objects;
    ObjectNameToIndexMap m_object_name_to_index_map;
    lldb_private::DataExtractor m_data; ///< The data for this object container
                                        ///so we don't lose data if the .a files
                                        ///gets modified
  };

  void SetArchive(Archive::shared_ptr &archive_sp);

  Archive::shared_ptr m_archive_sp;
};

#endif // LLDB_SOURCE_PLUGINS_OBJECTCONTAINER_BSD_ARCHIVE_OBJECTCONTAINERBSDARCHIVE_H


text:
package org.assertj.db.api.assertions.impl;

import org.assertj.core.api.WritableAssertionInfo;
import org.assertj.core.internal.Failures;
import org.assertj.db.api.AbstractAssert;
import org.assertj.db.error.ShouldBeValueTypeOfAny;
import org.assertj.db.type.Value;
import org.assertj.db.type.ValueType;

import static org.assertj.db.error.ShouldBeValueType.shouldBeValueType;

/**
 * Implements the assertion methods on the type of a value.
 *
The different type of values are enumerated in {@link org.assertj.db.type.ValueType}.

 *
 * @author Régis Pouiller
 * @author Otoniel Isidoro
 * @see org.assertj.db.api.assertions.AssertOnValueType
 */
public class AssertionsOnValueType {

  /**
   * To notice failures in the assertion.
   */
  private final static Failures failures = Failures.instance();

  /**
   * Private constructor.
   */
  private AssertionsOnValueType() {
    // Empty
  }

  /**
   * Verifies that the type of the value is equal to the type in parameter.
   *
   * @param        The type of the assertion which call this method.
   * @param assertion The assertion which call this method.
   * @param info      Writable information about an assertion.
   * @param value     The value.
   * @param expected  The expected type to compare to.
   * @return {@code this} assertion object.
   * @throws AssertionError If the type of the value is different to the type in parameter.
   */
  public static  A isOfType(A assertion, WritableAssertionInfo info, Value value,
                                                      ValueType expected) {
    ValueType type = value.getValueType();
    if (type != expected) {
      throw failures.failure(info, shouldBeValueType(value, type, expected));
    }
    return assertion;
  }

  /**
   * Verifies that the type of the value is equal to one of the types in parameters.
   *
   * @param        The type of the assertion which call this method.
   * @param assertion The assertion which call this method.
   * @param info      Writable information about an assertion.
   * @param value     The value.
   * @param expected  The expected types to compare to.
   * @return {@code this} assertion object.
   * @throws AssertionError If the type of the value is different to all the types in parameters.
   */
  public static  A isOfAnyTypeIn(A assertion, WritableAssertionInfo info, Value value,
                                                           ValueType... expected) {
    ValueType type = value.getValueType();
    for (ValueType valueType : expected) {
      if (type == valueType) {
        return assertion;
      }
    }
    throw failures.failure(info, ShouldBeValueTypeOfAny.shouldBeValueTypeOfAny(value, type, expected));
  }

  /**
   * Verifies that the value is a number.
   *
   * @param        The type of the assertion which call this method.
   * @param assertion The assertion which call this method.
   * @param info      Writable information about an assertion.
   * @param value     The value.
   * @return {@code this} assertion object.
   * @throws AssertionError If the type of the value is not number.
   */
  public static  A isNumber(A assertion, WritableAssertionInfo info, Value value) {
    return isOfType(assertion, info, value, ValueType.NUMBER);
  }

  /**
   * Verifies that the value is a boolean.
   *
   * @param        The type of the assertion which call this method.
   * @param assertion The assertion which call this method.
   * @param info      Writable information about an assertion.
   * @param value     The value.
   * @return {@code this} assertion object.
   * @throws AssertionError If the type of the value is not boolean.
   */
  public static  A isBoolean(A assertion, WritableAssertionInfo info, Value value) {
    return isOfType(assertion, info, value, ValueType.BOOLEAN);
  }

  /**
   * Verifies that the value is a date.
   *
   * @param        The type of the assertion which call this method.
   * @param assertion The assertion which call this method.
   * @param info      Writable information about an assertion.
   * @param value     The value.
   * @return {@code this} assertion object.
   * @throws AssertionError If the type of the value is not date.
   */
  public static  A isDate(A assertion, WritableAssertionInfo info, Value value) {
    return isOfType(assertion, info, value, ValueType.DATE);
  }

  /**
   * Verifies that the value is a time.
   *
   * @param        The type of the assertion which call this method.
   * @param assertion The assertion which call this method.
   * @param info      Writable information about an assertion.
   * @param value     The value.
   * @return {@code this} assertion object.
   * @throws AssertionError If the type of the value is not time.
   */
  public static  A isTime(A assertion, WritableAssertionInfo info, Value value) {
    return isOfType(assertion, info, value, ValueType.TIME);
  }

  /**
   * Verifies that the value is a date/time.
   *
   * @param        The type of the assertion which call this method.
   * @param assertion The assertion which call this method.
   * @param info      Writable information about an assertion.
   * @param value     The value.
   * @return {@code this} assertion object.
   * @throws AssertionError If the type of the value is not date/time.
   */
  public static  A isDateTime(A assertion, WritableAssertionInfo info, Value value) {
    return isOfType(assertion, info, value, ValueType.DATE_TIME);
  }

  /**
   * Verifies that the value is a array of bytes.
   *
   * @param        The type of the assertion which call this method.
   * @param assertion The assertion which call this method.
   * @param info      Writable information about an assertion.
   * @param value     The value.
   * @return {@code this} assertion object.
   * @throws AssertionError If the type of the value is not array of bytes.
   */
  public static  A isBytes(A assertion, WritableAssertionInfo info, Value value) {
    return isOfType(assertion, info, value, ValueType.BYTES);
  }

  /**
   * Verifies that the value is a text.
   *
   * @param        The type of the assertion which call this method.
   * @param assertion The assertion which call this method.
   * @param info      Writable information about an assertion.
   * @param value     The value.
   * @return {@code this} assertion object.
   * @throws AssertionError If the type of the value is not text.
   */
  public static  A isText(A assertion, WritableAssertionInfo info, Value value) {
    return isOfType(assertion, info, value, ValueType.TEXT);
  }

  /**
   * Verifies that the value is an UUID.
   *
   * @param        The type of the assertion which call this method.
   * @param assertion The assertion which call this method.
   * @param info      Writable information about an assertion.
   * @param value     The value.
   * @return {@code this} assertion object.
   * @throws AssertionError If the type of the value is not UUID.
   * @since 1.1.0
   */
  public static  A isUUID(A assertion, WritableAssertionInfo info, Value value) {
    return isOfType(assertion, info, value, ValueType.UUID);
  }

}


text:
from app import app, db, models
from flask import render_template, flash, redirect, jsonify

# Helper Functions

def get_sorted_people(data):
    titles = [x.title for x in data]
    if 'Director' in titles:
        utitle=['Director']
    if 'Postdocs' in titles:
        utitle.append('Postdocs')
    if 'Graduate Students' in titles:
        utitle.append('Graduate Students')
    if 'Lab Manager' in titles:
        utitle.append('Lab Manager')
    if 'Research Assistants' in titles:
        utitle.append('Research Assistants')
    if 'Coding Companion' in titles:
        utitle.append('Coding Companion')
    if 'Lab Alumni' in titles:
        utitle.append('Lab Alumni')
    return utitle

def get_sorted_years(data):
    years = [int(x.year) for x in data]
    uyear = list(set(years)) #get unique years - may need to reverse sort eventually
    uyear.sort(reverse=True)
    return uyear

def flatten_list(tags):
    flat = []
    for sublist in tags:
        for i in sublist:
            flat.append(i)
    return flat

class TagCount(object):
    def __init__(self, name, count):
        self.name = name
        self.count = count

    def __repr__(self):
        return 'Tags: %s: %s' % (self.name, self.count)

def get_tag_counts(data):
    tags = [x.tags for x in data]
    flat = [str(x) for x in flatten_list(tags)]
    tag_list = [str(x) for x in list(set(flatten_list(tags)))]
    tag_list.sort()
    tags = [x.tags for x in data]
    return [TagCount(i, flat.count(i)) for i in tag_list]

def get_resource_type_list(data):
    resource_list = list(set([x.type for x in data]))
    if 'Software' in resource_list:
        sorted_resources = ['Software']
    if 'Tutorials' in resource_list:
        sorted_resources.append('Tutorials')

    for i in list(set(resource_list) - set(sorted_resources)):
        sorted_resources.append(i)
    return sorted_resources

def get_type_list(data):
    resource_list = list(set([x.type for x in data]))
    resource_list.sort(reverse=False)
    return resource_list

def get_position_type_list(data):
    position_list = list(set([x.position for x in data]))
    position_list.sort(reverse=False)
    return position_list

# Routes
@app.route('/')
def home():
    return render_template('home.html')

@app.route('/research')
def research():
    data = models.Research.query.all()
    return render_template('research.html', research_list=data)

@app.route('/people')
def people():
    data = models.User.query.all()
    return render_template('people.html', utitle = get_sorted_people(data))

@app.route('/publications')
def publications():
    data = models.Papers.query.all()
    return render_template('publications.html',
                            uyear=get_sorted_years(data),
                            tag_list=get_tag_counts(data))

@app.route('/resources')
def resources():
    data = models.Resources.query.all()
    return render_template('resources.html',
                            resource_type_list=get_resource_type_list(data),
                            resource_list=data)

@app.route('/teaching')
def teaching():
    data = models.Teaching.query.all()
    return render_template('teaching.html',
                            teaching_type_list=get_type_list(data),
                            teaching_list=data)

@app.route('/positions')
def positions():
    data = models.Positions.query.all()
    return render_template('positions.html',
                            position_type_list=get_position_type_list(data),
                            positions_list=data)

@app.route('/news')
def news():
    return render_template('news.html')

@app.errorhandler(404)
def fourohfour(error):
	return render_template('fourohfour.html')


text:
#pragma once
#include <aws/dms/DatabaseMigrationService_EXPORTS.h>
#include <aws/core/Region.h>
#include <aws/core/utils/memory/stl/AWSString.h>

namespace Aws
{

namespace DatabaseMigrationService
{
namespace DatabaseMigrationServiceEndpoint
{
AWS_DATABASEMIGRATIONSERVICE_API Aws::String ForRegion(const Aws::String& regionName, bool useDualStack = false);
} // namespace DatabaseMigrationServiceEndpoint
} // namespace DatabaseMigrationService
} // namespace Aws


text:
package com.bugsnag.mazerunner.scenarios;

import com.bugsnag.Bugsnag;
import com.bugsnag.Report;
import com.bugsnag.callbacks.Callback;

/**
 * Sends a handled exception to Bugsnag, which contains metadata that should be filtered
 */
public class AutoFilterScenario extends Scenario {

    public AutoFilterScenario(Bugsnag bugsnag) {
        super(bugsnag);
    }

    @Override
    public void run() {
        bugsnag.notify(generateException(), new Callback() {
            @Override
            public void beforeNotify(Report report) {
                report.addToTab("user", "password", "hunter2");
                report.addToTab("custom", "password", "hunter2");
                report.addToTab("custom", "foo", "hunter2");
            }
        });
    }
}


text:
package com.sustech.flightbooking.persistence;

import com.sustech.flightbooking.domainmodel.Flight;
import com.sustech.flightbooking.domainmodel.Order;
import com.sustech.flightbooking.domainmodel.Passenger;

import java.util.List;

public interface OrderRepository extends Repository<Order> {
    List<Order> findByFlight(Flight flight);

    List<Order> findByPassenger(Passenger passenger);
}


text:
"""utility functions for preprocessor tests"""

# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.

from IPython.nbformat import v4 as nbformat

from ...tests.base import TestsBase
from ...exporters.exporter import ResourcesDict

class PreprocessorTestsBase(TestsBase):

    """Contains test functions preprocessor tests"""

    def build_notebook(self):
        """Build a notebook in memory for use with preprocessor tests"""

        outputs = [
            nbformat.new_output("stream", name="stdout", text="a"),
            nbformat.new_output("display_data", data={'text/plain': 'b'}),
            nbformat.new_output("stream", name="stdout", text="c"),
            nbformat.new_output("stream", name="stdout", text="d"),
            nbformat.new_output("stream", name="stderr", text="e"),
            nbformat.new_output("stream", name="stderr", text="f"),
            nbformat.new_output(
                "display_data", data={'image/png': 'Zw=='}),  # g
            nbformat.new_output(
                "display_data", data={'application/pdf': 'aA=='}),  # h
        ]

        cells = [nbformat.new_code_cell(source="$ e $", execution_count=1, outputs=outputs),
                 nbformat.new_markdown_cell(source="$ e $")]

        return nbformat.new_notebook(cells=cells)

    def build_resources(self):
        """Build an empty resources dictionary."""

        res = ResourcesDict()
        res['metadata'] = ResourcesDict()
        return res


text:
require 'mechanize'
require 'ostruct'
require 'bsf/scraper/fund_data_populator/holdings_page_parser'

describe Bsf::Scraper::FundDataPopulator::HoldingsPageParser do

  describe '.initialize' do
    it { expect { described_class.new }.to raise_error(ArgumentError,
                                                       /0 for 3/) }
  end

  describe '#parse' do

    let(:fund) {OpenStruct.new}
    let(:current_fund_price) { 14.00 }

    before(:each) do
      described_class.new(fund, dummy_page, current_fund_price).parse
    end

    it 'should parse the biggest position' do
      fund.biggest_position.should == 4.14
    end

    it 'should parse the original price' do
      fund.original_price.should == 13.44
    end

    it 'should parse the original price book' do
      fund.original_price_book.should == 2.22
    end

    it 'should parse the original price earnings' do
      fund.original_price_earnings.should == 17.87
    end

    it 'should parse the original price cashflow' do
      fund.original_price_cashflow.should == 9.77
    end

    it 'should parse the original price sales' do
      fund.original_price_sales.should == 1.42
    end

    it 'should set the price' do
      fund.price.should == 14
    end

    it 'should calculate the current price book' do
      fund.pb.should == 2.3125000000000004
    end

    it 'should calculate the current price earnings' do
      fund.pe.should == 18.614583333333336
    end

    it 'should calculate the current price cashflow' do
      fund.pcf.should == 10.177083333333334
    end

    it 'should calculate the current price sales' do
      fund.ps.should == 1.4791666666666667
    end

  end

  def dummy_page
    @dummy_page ||= Mechanize.new.get("file:///#{$spec_home}/fixtures/yahoo_holdings_page.html")
  end

end


text:
namespace doppia_protobuf {

// Internal implementation detail -- do not call these.
void  protobuf_AddDesc_detections_2eproto();
void protobuf_AssignDesc_detections_2eproto();
void protobuf_ShutdownFile_detections_2eproto();

class Point2d;
class Box;
class Detection;
class Detections;

enum Detection_ObjectClasses {
  Detection_ObjectClasses_Car = 2,
  Detection_ObjectClasses_Pedestrian = 3,
  Detection_ObjectClasses_Bike = 5,
  Detection_ObjectClasses_Motorbike = 6,
  Detection_ObjectClasses_Bus = 7,
  Detection_ObjectClasses_Tram = 8,
  Detection_ObjectClasses_StaticObject = 4,
  Detection_ObjectClasses_Unknown = 0
};
bool Detection_ObjectClasses_IsValid(int value);
const Detection_ObjectClasses Detection_ObjectClasses_ObjectClasses_MIN = Detection_ObjectClasses_Unknown;
const Detection_ObjectClasses Detection_ObjectClasses_ObjectClasses_MAX = Detection_ObjectClasses_Tram;
const int Detection_ObjectClasses_ObjectClasses_ARRAYSIZE = Detection_ObjectClasses_ObjectClasses_MAX + 1;

const ::google::protobuf::EnumDescriptor* Detection_ObjectClasses_descriptor();
inline const ::std::string& Detection_ObjectClasses_Name(Detection_ObjectClasses value) {
  return ::google::protobuf::internal::NameOfEnum(
    Detection_ObjectClasses_descriptor(), value);
}
inline bool Detection_ObjectClasses_Parse(
    const ::std::string& name, Detection_ObjectClasses* value) {
  return ::google::protobuf::internal::ParseNamedEnum<Detection_ObjectClasses>(
    Detection_ObjectClasses_descriptor(), name, value);
}
// ===================================================================

class Point2d : public ::google::protobuf::Message {
 public:
  Point2d();
  virtual ~Point2d();

  Point2d(const Point2d& from);

  inline Point2d& operator=(const Point2d& from) {
    CopyFrom(from);
    return *this;
  }

  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
    return _unknown_fields_;
  }

  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
    return &_unknown_fields_;
  }

  static const ::google::protobuf::Descriptor* descriptor();
  static const Point2d& default_instance();

  void Swap(Point2d* other);

  // implements Message ----------------------------------------------

  Point2d* New() const;
  void CopyFrom(const ::google::protobuf::Message& from);
  void MergeFrom(const ::google::protobuf::Message& from);
  void CopyFrom(const Point2d& from);
  void MergeFrom(const Point2d& from);
  void Clear();
  bool IsInitialized() const;

  int ByteSize() const;
  bool MergePartialFromCodedStream(
      ::google::protobuf::io::CodedInputStream* input);
  void SerializeWithCachedSizes(
      ::google::protobuf::io::CodedOutputStream* output) const;
  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
  int GetCachedSize() const { return _cached_size_; }
  private:
  void SharedCtor();
  void SharedDtor();
  void SetCachedSize(int size) const;
  public:

  ::google::protobuf::Metadata GetMetadata() const;

  // nested types ----------------------------------------------------

  // accessors -------------------------------------------------------

  // required int32 x = 1;
  inline bool has_x() const;
  inline void clear_x();
  static const int kXFieldNumber = 1;
  inline ::google::protobuf::int32 x() const;
  inline void set_x(::google::protobuf::int32 value);

  // required int32 y = 2;
  inline bool has_y() const;
  inline void clear_y();
  static const int kYFieldNumber = 2;
  inline ::google::protobuf::int32 y() const;
  inline void set_y(::google::protobuf::int32 value);

  // @@protoc_insertion_point(class_scope:doppia_protobuf.Point2d)
 private:
  inline void set_has_x();
  inline void clear_has_x();
  inline void set_has_y();
  inline void clear_has_y();

  ::google::protobuf::UnknownFieldSet _unknown_fields_;

  ::google::protobuf::int32 x_;
  ::google::protobuf::int32 y_;

  mutable int _cached_size_;
  ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];

  friend void  protobuf_AddDesc_detections_2eproto();
  friend void protobuf_AssignDesc_detections_2eproto();
  friend void protobuf_ShutdownFile_detections_2eproto();

  void InitAsDefaultInstance();
  static Point2d* default_instance_;
};
// -------------------------------------------------------------------

class Box : public ::google::protobuf::Message {
 public:
  Box();
  virtual ~Box();

  Box(const Box& from);

  inline Box& operator=(const Box& from) {
    CopyFrom(from);
    return *this;
  }

  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
    return _unknown_fields_;
  }

  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
    return &_unknown_fields_;
  }

  static const ::google::protobuf::Descriptor* descriptor();
  static const Box& default_instance();

  void Swap(Box* other);

  // implements Message ----------------------------------------------

  Box* New() const;
  void CopyFrom(const ::google::protobuf::Message& from);
  void MergeFrom(const ::google::protobuf::Message& from);
  void CopyFrom(const Box& from);
  void MergeFrom(const Box& from);
  void Clear();
  bool IsInitialized() const;

  int ByteSize() const;
  bool MergePartialFromCodedStream(
      ::google::protobuf::io::CodedInputStream* input);
  void SerializeWithCachedSizes(
      ::google::protobuf::io::CodedOutputStream* output) const;
  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
  int GetCachedSize() const { return _cached_size_; }
  private:
  void SharedCtor();
  void SharedDtor();
  void SetCachedSize(int size) const;
  public:

  ::google::protobuf::Metadata GetMetadata() const;

  // nested types ----------------------------------------------------

  // accessors -------------------------------------------------------

  // required .doppia_protobuf.Point2d min_corner = 1;
  inline bool has_min_corner() const;
  inline void clear_min_corner();
  static const int kMinCornerFieldNumber = 1;
  inline const ::doppia_protobuf::Point2d& min_corner() const;
  inline ::doppia_protobuf::Point2d* mutable_min_corner();
  inline ::doppia_protobuf::Point2d* release_min_corner();
  inline void set_allocated_min_corner(::doppia_protobuf::Point2d* min_corner);

  // required .doppia_protobuf.Point2d max_corner = 2;
  inline bool has_max_corner() const;
  inline void clear_max_corner();
  static const int kMaxCornerFieldNumber = 2;
  inline const ::doppia_protobuf::Point2d& max_corner() const;
  inline ::doppia_protobuf::Point2d* mutable_max_corner();
  inline ::doppia_protobuf::Point2d* release_max_corner();
  inline void set_allocated_max_corner(::doppia_protobuf::Point2d* max_corner);

  // @@protoc_insertion_point(class_scope:doppia_protobuf.Box)
 private:
  inline void set_has_min_corner();
  inline void clear_has_min_corner();
  inline void set_has_max_corner();
  inline void clear_has_max_corner();

  ::google::protobuf::UnknownFieldSet _unknown_fields_;

  ::doppia_protobuf::Point2d* min_corner_;
  ::doppia_protobuf::Point2d* max_corner_;

  mutable int _cached_size_;
  ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];

  friend void  protobuf_AddDesc_detections_2eproto();
  friend void protobuf_AssignDesc_detections_2eproto();
  friend void protobuf_ShutdownFile_detections_2eproto();

  void InitAsDefaultInstance();
  static Box* default_instance_;
};
// -------------------------------------------------------------------

class Detection : public ::google::protobuf::Message {
 public:
  Detection();
  virtual ~Detection();

  Detection(const Detection& from);

  inline Detection& operator=(const Detection& from) {
    CopyFrom(from);
    return *this;
  }

  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
    return _unknown_fields_;
  }

  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
    return &_unknown_fields_;
  }

  static const ::google::protobuf::Descriptor* descriptor();
  static const Detection& default_instance();

  void Swap(Detection* other);

  // implements Message ----------------------------------------------

  Detection* New() const;
  void CopyFrom(const ::google::protobuf::Message& from);
  void MergeFrom(const ::google::protobuf::Message& from);
  void CopyFrom(const Detection& from);
  void MergeFrom(const Detection& from);
  void Clear();
  bool IsInitialized() const;

  int ByteSize() const;
  bool MergePartialFromCodedStream(
      ::google::protobuf::io::CodedInputStream* input);
  void SerializeWithCachedSizes(
      ::google::protobuf::io::CodedOutputStream* output) const;
  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
  int GetCachedSize() const { return _cached_size_; }
  private:
  void SharedCtor();
  void SharedDtor();
  void SetCachedSize(int size) const;
  public:

  ::google::protobuf::Metadata GetMetadata() const;

  // nested types ----------------------------------------------------

  typedef Detection_ObjectClasses ObjectClasses;
  static const ObjectClasses Car = Detection_ObjectClasses_Car;
  static const ObjectClasses Pedestrian = Detection_ObjectClasses_Pedestrian;
  static const ObjectClasses Bike = Detection_ObjectClasses_Bike;
  static const ObjectClasses Motorbike = Detection_ObjectClasses_Motorbike;
  static const ObjectClasses Bus = Detection_ObjectClasses_Bus;
  static const ObjectClasses Tram = Detection_ObjectClasses_Tram;
  static const ObjectClasses StaticObject = Detection_ObjectClasses_StaticObject;
  static const ObjectClasses Unknown = Detection_ObjectClasses_Unknown;
  static inline bool ObjectClasses_IsValid(int value) {
    return Detection_ObjectClasses_IsValid(value);
  }
  static const ObjectClasses ObjectClasses_MIN =
    Detection_ObjectClasses_ObjectClasses_MIN;
  static const ObjectClasses ObjectClasses_MAX =
    Detection_ObjectClasses_ObjectClasses_MAX;
  static const int ObjectClasses_ARRAYSIZE =
    Detection_ObjectClasses_ObjectClasses_ARRAYSIZE;
  static inline const ::google::protobuf::EnumDescriptor*
  ObjectClasses_descriptor() {
    return Detection_ObjectClasses_descriptor();
  }
  static inline const ::std::string& ObjectClasses_Name(ObjectClasses value) {
    return Detection_ObjectClasses_Name(value);
  }
  static inline bool ObjectClasses_Parse(const ::std::string& name,
      ObjectClasses* value) {
    return Detection_ObjectClasses_Parse(name, value);
  }

  // accessors -------------------------------------------------------

  // required .doppia_protobuf.Box bounding_box = 1;
  inline bool has_bounding_box() const;
  inline void clear_bounding_box();
  static const int kBoundingBoxFieldNumber = 1;
  inline const ::doppia_protobuf::Box& bounding_box() const;
  inline ::doppia_protobuf::Box* mutable_bounding_box();
  inline ::doppia_protobuf::Box* release_bounding_box();
  inline void set_allocated_bounding_box(::doppia_protobuf::Box* bounding_box);

  // required .doppia_protobuf.Detection.ObjectClasses object_class = 2;
  inline bool has_object_class() const;
  inline void clear_object_class();
  static const int kObjectClassFieldNumber = 2;
  inline ::doppia_protobuf::Detection_ObjectClasses object_class() const;
  inline void set_object_class(::doppia_protobuf::Detection_ObjectClasses value);

  // optional float score = 3;
  inline bool has_score() const;
  inline void clear_score();
  static const int kScoreFieldNumber = 3;
  inline float score() const;
  inline void set_score(float value);

  // @@protoc_insertion_point(class_scope:doppia_protobuf.Detection)
 private:
  inline void set_has_bounding_box();
  inline void clear_has_bounding_box();
  inline void set_has_object_class();
  inline void clear_has_object_class();
  inline void set_has_score();
  inline void clear_has_score();

  ::google::protobuf::UnknownFieldSet _unknown_fields_;

  ::doppia_protobuf::Box* bounding_box_;
  int object_class_;
  float score_;

  mutable int _cached_size_;
  ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32];

  friend void  protobuf_AddDesc_detections_2eproto();
  friend void protobuf_AssignDesc_detections_2eproto();
  friend void protobuf_ShutdownFile_detections_2eproto();

  void InitAsDefaultInstance();
  static Detection* default_instance_;
};
// -------------------------------------------------------------------

class Detections : public ::google::protobuf::Message {
 public:
  Detections();
  virtual ~Detections();

  Detections(const Detections& from);

  inline Detections& operator=(const Detections& from) {
    CopyFrom(from);
    return *this;
  }

  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
    return _unknown_fields_;
  }

  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
    return &_unknown_fields_;
  }

  static const ::google::protobuf::Descriptor* descriptor();
  static const Detections& default_instance();

  void Swap(Detections* other);

  // implements Message ----------------------------------------------

  Detections* New() const;
  void CopyFrom(const ::google::protobuf::Message& from);
  void MergeFrom(const ::google::protobuf::Message& from);
  void CopyFrom(const Detections& from);
  void MergeFrom(const Detections& from);
  void Clear();
  bool IsInitialized() const;

  int ByteSize() const;
  bool MergePartialFromCodedStream(
      ::google::protobuf::io::CodedInputStream* input);
  void SerializeWithCachedSizes(
      ::google::protobuf::io::CodedOutputStream* output) const;
  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
  int GetCachedSize() const { return _cached_size_; }
  private:
  void SharedCtor();
  void SharedDtor();
  void SetCachedSize(int size) const;
  public:

  ::google::protobuf::Metadata GetMetadata() const;

  // nested types ----------------------------------------------------

  // accessors -------------------------------------------------------

  // optional string image_name = 1;
  inline bool has_image_name() const;
  inline void clear_image_name();
  static const int kImageNameFieldNumber = 1;
  inline const ::std::string& image_name() const;
  inline void set_image_name(const ::std::string& value);
  inline void set_image_name(const char* value);
  inline void set_image_name(const char* value, size_t size);
  inline ::std::string* mutable_image_name();
  inline ::std::string* release_image_name();
  inline void set_allocated_image_name(::std::string* image_name);

  // repeated .doppia_protobuf.Detection detections = 2;
  inline int detections_size() const;
  inline void clear_detections();
  static const int kDetectionsFieldNumber = 2;
  inline const ::doppia_protobuf::Detection& detections(int index) const;
  inline ::doppia_protobuf::Detection* mutable_detections(int index);
  inline ::doppia_protobuf::Detection* add_detections();
  inline const ::google::protobuf::RepeatedPtrField< ::doppia_protobuf::Detection >&
      detections() const;
  inline ::google::protobuf::RepeatedPtrField< ::doppia_protobuf::Detection >*
      mutable_detections();

  // @@protoc_insertion_point(class_scope:doppia_protobuf.Detections)
 private:
  inline void set_has_image_name();
  inline void clear_has_image_name();

  ::google::protobuf::UnknownFieldSet _unknown_fields_;

  ::std::string* image_name_;
  ::google::protobuf::RepeatedPtrField< ::doppia_protobuf::Detection > detections_;

  mutable int _cached_size_;
  ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];

  friend void  protobuf_AddDesc_detections_2eproto();
  friend void protobuf_AssignDesc_detections_2eproto();
  friend void protobuf_ShutdownFile_detections_2eproto();

  void InitAsDefaultInstance();
  static Detections* default_instance_;
};
// ===================================================================

// ===================================================================

// Point2d

// required int32 x = 1;
inline bool Point2d::has_x() const {
  return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void Point2d::set_has_x() {
  _has_bits_[0] |= 0x00000001u;
}
inline void Point2d::clear_has_x() {
  _has_bits_[0] &= ~0x00000001u;
}
inline void Point2d::clear_x() {
  x_ = 0;
  clear_has_x();
}
inline ::google::protobuf::int32 Point2d::x() const {
  return x_;
}
inline void Point2d::set_x(::google::protobuf::int32 value) {
  set_has_x();
  x_ = value;
}

// required int32 y = 2;
inline bool Point2d::has_y() const {
  return (_has_bits_[0] & 0x00000002u) != 0;
}
inline void Point2d::set_has_y() {
  _has_bits_[0] |= 0x00000002u;
}
inline void Point2d::clear_has_y() {
  _has_bits_[0] &= ~0x00000002u;
}
inline void Point2d::clear_y() {
  y_ = 0;
  clear_has_y();
}
inline ::google::protobuf::int32 Point2d::y() const {
  return y_;
}
inline void Point2d::set_y(::google::protobuf::int32 value) {
  set_has_y();
  y_ = value;
}

// -------------------------------------------------------------------

// Box

// required .doppia_protobuf.Point2d min_corner = 1;
inline bool Box::has_min_corner() const {
  return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void Box::set_has_min_corner() {
  _has_bits_[0] |= 0x00000001u;
}
inline void Box::clear_has_min_corner() {
  _has_bits_[0] &= ~0x00000001u;
}
inline void Box::clear_min_corner() {
  if (min_corner_ != NULL) min_corner_->::doppia_protobuf::Point2d::Clear();
  clear_has_min_corner();
}
inline const ::doppia_protobuf::Point2d& Box::min_corner() const {
  return min_corner_ != NULL ? *min_corner_ : *default_instance_->min_corner_;
}
inline ::doppia_protobuf::Point2d* Box::mutable_min_corner() {
  set_has_min_corner();
  if (min_corner_ == NULL) min_corner_ = new ::doppia_protobuf::Point2d;
  return min_corner_;
}
inline ::doppia_protobuf::Point2d* Box::release_min_corner() {
  clear_has_min_corner();
  ::doppia_protobuf::Point2d* temp = min_corner_;
  min_corner_ = NULL;
  return temp;
}
inline void Box::set_allocated_min_corner(::doppia_protobuf::Point2d* min_corner) {
  delete min_corner_;
  min_corner_ = min_corner;
  if (min_corner) {
    set_has_min_corner();
  } else {
    clear_has_min_corner();
  }
}

// required .doppia_protobuf.Point2d max_corner = 2;
inline bool Box::has_max_corner() const {
  return (_has_bits_[0] & 0x00000002u) != 0;
}
inline void Box::set_has_max_corner() {
  _has_bits_[0] |= 0x00000002u;
}
inline void Box::clear_has_max_corner() {
  _has_bits_[0] &= ~0x00000002u;
}
inline void Box::clear_max_corner() {
  if (max_corner_ != NULL) max_corner_->::doppia_protobuf::Point2d::Clear();
  clear_has_max_corner();
}
inline const ::doppia_protobuf::Point2d& Box::max_corner() const {
  return max_corner_ != NULL ? *max_corner_ : *default_instance_->max_corner_;
}
inline ::doppia_protobuf::Point2d* Box::mutable_max_corner() {
  set_has_max_corner();
  if (max_corner_ == NULL) max_corner_ = new ::doppia_protobuf::Point2d;
  return max_corner_;
}
inline ::doppia_protobuf::Point2d* Box::release_max_corner() {
  clear_has_max_corner();
  ::doppia_protobuf::Point2d* temp = max_corner_;
  max_corner_ = NULL;
  return temp;
}
inline void Box::set_allocated_max_corner(::doppia_protobuf::Point2d* max_corner) {
  delete max_corner_;
  max_corner_ = max_corner;
  if (max_corner) {
    set_has_max_corner();
  } else {
    clear_has_max_corner();
  }
}

// -------------------------------------------------------------------

// Detection

// required .doppia_protobuf.Box bounding_box = 1;
inline bool Detection::has_bounding_box() const {
  return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void Detection::set_has_bounding_box() {
  _has_bits_[0] |= 0x00000001u;
}
inline void Detection::clear_has_bounding_box() {
  _has_bits_[0] &= ~0x00000001u;
}
inline void Detection::clear_bounding_box() {
  if (bounding_box_ != NULL) bounding_box_->::doppia_protobuf::Box::Clear();
  clear_has_bounding_box();
}
inline const ::doppia_protobuf::Box& Detection::bounding_box() const {
  return bounding_box_ != NULL ? *bounding_box_ : *default_instance_->bounding_box_;
}
inline ::doppia_protobuf::Box* Detection::mutable_bounding_box() {
  set_has_bounding_box();
  if (bounding_box_ == NULL) bounding_box_ = new ::doppia_protobuf::Box;
  return bounding_box_;
}
inline ::doppia_protobuf::Box* Detection::release_bounding_box() {
  clear_has_bounding_box();
  ::doppia_protobuf::Box* temp = bounding_box_;
  bounding_box_ = NULL;
  return temp;
}
inline void Detection::set_allocated_bounding_box(::doppia_protobuf::Box* bounding_box) {
  delete bounding_box_;
  bounding_box_ = bounding_box;
  if (bounding_box) {
    set_has_bounding_box();
  } else {
    clear_has_bounding_box();
  }
}

// required .doppia_protobuf.Detection.ObjectClasses object_class = 2;
inline bool Detection::has_object_class() const {
  return (_has_bits_[0] & 0x00000002u) != 0;
}
inline void Detection::set_has_object_class() {
  _has_bits_[0] |= 0x00000002u;
}
inline void Detection::clear_has_object_class() {
  _has_bits_[0] &= ~0x00000002u;
}
inline void Detection::clear_object_class() {
  object_class_ = 2;
  clear_has_object_class();
}
inline ::doppia_protobuf::Detection_ObjectClasses Detection::object_class() const {
  return static_cast< ::doppia_protobuf::Detection_ObjectClasses >(object_class_);
}
inline void Detection::set_object_class(::doppia_protobuf::Detection_ObjectClasses value) {
  assert(::doppia_protobuf::Detection_ObjectClasses_IsValid(value));
  set_has_object_class();
  object_class_ = value;
}

// optional float score = 3;
inline bool Detection::has_score() const {
  return (_has_bits_[0] & 0x00000004u) != 0;
}
inline void Detection::set_has_score() {
  _has_bits_[0] |= 0x00000004u;
}
inline void Detection::clear_has_score() {
  _has_bits_[0] &= ~0x00000004u;
}
inline void Detection::clear_score() {
  score_ = 0;
  clear_has_score();
}
inline float Detection::score() const {
  return score_;
}
inline void Detection::set_score(float value) {
  set_has_score();
  score_ = value;
}

// -------------------------------------------------------------------

// Detections

// optional string image_name = 1;
inline bool Detections::has_image_name() const {
  return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void Detections::set_has_image_name() {
  _has_bits_[0] |= 0x00000001u;
}
inline void Detections::clear_has_image_name() {
  _has_bits_[0] &= ~0x00000001u;
}
inline void Detections::clear_image_name() {
  if (image_name_ != &::google::protobuf::internal::kEmptyString) {
    image_name_->clear();
  }
  clear_has_image_name();
}
inline const ::std::string& Detections::image_name() const {
  return *image_name_;
}
inline void Detections::set_image_name(const ::std::string& value) {
  set_has_image_name();
  if (image_name_ == &::google::protobuf::internal::kEmptyString) {
    image_name_ = new ::std::string;
  }
  image_name_->assign(value);
}
inline void Detections::set_image_name(const char* value) {
  set_has_image_name();
  if (image_name_ == &::google::protobuf::internal::kEmptyString) {
    image_name_ = new ::std::string;
  }
  image_name_->assign(value);
}
inline void Detections::set_image_name(const char* value, size_t size) {
  set_has_image_name();
  if (image_name_ == &::google::protobuf::internal::kEmptyString) {
    image_name_ = new ::std::string;
  }
  image_name_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* Detections::mutable_image_name() {
  set_has_image_name();
  if (image_name_ == &::google::protobuf::internal::kEmptyString) {
    image_name_ = new ::std::string;
  }
  return image_name_;
}
inline ::std::string* Detections::release_image_name() {
  clear_has_image_name();
  if (image_name_ == &::google::protobuf::internal::kEmptyString) {
    return NULL;
  } else {
    ::std::string* temp = image_name_;
    image_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
    return temp;
  }
}
inline void Detections::set_allocated_image_name(::std::string* image_name) {
  if (image_name_ != &::google::protobuf::internal::kEmptyString) {
    delete image_name_;
  }
  if (image_name) {
    set_has_image_name();
    image_name_ = image_name;
  } else {
    clear_has_image_name();
    image_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
  }
}

// repeated .doppia_protobuf.Detection detections = 2;
inline int Detections::detections_size() const {
  return detections_.size();
}
inline void Detections::clear_detections() {
  detections_.Clear();
}
inline const ::doppia_protobuf::Detection& Detections::detections(int index) const {
  return detections_.Get(index);
}
inline ::doppia_protobuf::Detection* Detections::mutable_detections(int index) {
  return detections_.Mutable(index);
}
inline ::doppia_protobuf::Detection* Detections::add_detections() {
  return detections_.Add();
}
inline const ::google::protobuf::RepeatedPtrField< ::doppia_protobuf::Detection >&
Detections::detections() const {
  return detections_;
}
inline ::google::protobuf::RepeatedPtrField< ::doppia_protobuf::Detection >*
Detections::mutable_detections() {
  return &detections_;
}

// @@protoc_insertion_point(namespace_scope)

}  // namespace doppia_protobuf

#ifndef SWIG
namespace google {
namespace protobuf {

template <>
inline const EnumDescriptor* GetEnumDescriptor< ::doppia_protobuf::Detection_ObjectClasses>() {
  return ::doppia_protobuf::Detection_ObjectClasses_descriptor();
}

}  // namespace google
}  // namespace protobuf
#endif  // SWIG

// @@protoc_insertion_point(global_scope)

#endif  // PROTOBUF_detections_2eproto__INCLUDED


text:
@class OSCollectionChooseItem;
typedef void (^OSCollectionChooseViewControllerOnItemTap)(OSCollectionChooseItem *item);

@interface OSCollectionChooseViewController : OSListViewController

@property(nonatomic, copy) OSCollectionChooseViewControllerOnItemTap onItemTap;

@end


text:
module Roar::Rails
  class Responder < ActionController::Responder
    module VersionStrategy
    end
  end

  module TestCase
    module VersionStrategy
      def process_args(action, http_method, document="", params={})
        [action, params, nil, nil, http_method]
      end
    end
  end
end


text:
<?php

namespace Knp\RadBundle\DataFixtures;

use Doctrine\Common\DataFixtures\ReferenceRepository;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\PropertyAccess\PropertyAccessor;

class ObjectFactory
{
    private $manager;
    private $className;
    private $defaultAttributes = array();

    public function __construct(
        ReferenceRepository $referenceRepository,
        ReferenceManipulator $referenceManipulator,
        ObjectManager $manager,
        $className,
        PropertyAccessor $accessor = null
    )
    {
        $this->referenceRepository  = $referenceRepository;
        $this->referenceManipulator = $referenceManipulator;
        $this->manager              = $manager;
        $this->className            = $className;
        $this->accessor             = $accessor ?: PropertyAccess::createPropertyAccessor();
    }

    public function add(array $attributes = array())
    {
        // We do not override $attributes because the reference manipulator will use the first element to generate the reference name
        $mergedAttributes = array_merge($this->defaultAttributes, $attributes);
        $object = new $this->className();

        foreach ($mergedAttributes as $attribute => $value) {
            $this->accessor->setValue($object, $attribute, $value);
        }

        $this->referenceRepository->addReference(
            $this->referenceManipulator->createReferenceName($this->className, $attributes),
            $object
        );

        $this->manager->persist($object);

        return $this;
    }

    public function setDefaults(array $attributes = array())
    {
        $this->defaultAttributes = $attributes;

        return $this;
    }
}


text:
Flask-DataTables
========

- - -

DataTables is a great table js tool, i has used Flask for a month

I want to use DataTables ajax mothed in Flask easier.

It's almost a full rewrite, so this project page is no longer recent working.

Datatables is here: https://datatables.net/release-datatables/examples/data_sources/ajax.html

## CAUTION!!

- - -

#### JavaScript Library for Objective Sound Programming ####

### System Requirements ###
* Chrome 14.0- (Web Audio API)
* Safari 6.0- (Web Audio API)
* Firefox 4.0- (Audio Data API)

### Usage ###

### License ###

MIT

### ChangeLog ###

2013 07 19 - **v0.1.0**

* Initial release of Flask-DataTables


text:
Solutions to the Matasano Crypto Challenges for learning practical cryptography
and cryptanalysis. The code is written in Haskell.

http://cryptopals.com/


text:
immutable Combinator
    use::Function
end

Query(C::Combinator) =
    cse(format(C.use(ItQuery(Void) |> setnamespace(DB))))

>>(q::Query, C::Combinator) =
    C.use(q)

(C::Combinator)() = C

convert(::Type{Combinator}, q::Query) =
    Combinator() do q′::Query
        (q′ >> q) |> setnamespace(q′.ns.db)
    end

execute{T}(C::Combinator, val::T=nothing; paramvals...) =
    execute(C.use(ItQuery(T)), val; paramvals...)

# Attribute access.

Field(tag::Symbol) =
    Combinator() do q::Query
        scope = oscope(q)
        maybe_binding = lookup(scope, tag, 0)
        @assert !isnull(maybe_binding) "cannot find attribute $tag in the scope of $(scope.dom)"
        binding = get(maybe_binding)
        (q >> compile(binding, scope, Syntax[])) |> setnamespace(scope.db)
    end

Fields(tag::Symbol, tags′::Symbol...) =
    (Field(tag), (Field(tag′) for tag′ in tags′)...)

convert(::Type{Combinator}, tag::Symbol) =
    Field(tag)

# Composition.

>>(L::Combinator, R::Combinator) =
    Combinator() do q::Query
        (q >> L) >> R
    end

# Null.

const Null =
    Combinator() do q::Query
        q >> NullQuery(domain(output(q)))
    end

# Identity.

const It =
    Combinator() do q::Query
        q
    end

# Decorations.

Decorate(F::Combinator, decor::Pair{Symbol}) =
    Combinator() do q::Query
        (q >> F) |> decorate(decor)
    end

ThenDecorate(decor::Pair{Symbol}) =
    Combinator() do q::Query
        q |> decorate(decor)
    end

ThenTag(tag::Symbol) =
    ThenDecorate(:tag => tag)

convert{T}(::Type{Combinator}, pair::Pair{Symbol,T}) =
    let (tag, F) = pair
        convert(Combinator, F) >> ThenTag(tag)
    end

# Constants.

Const(val) =
    Combinator() do q::Query
        q >> ConstQuery(val)
    end

convert(::Type{Combinator}, val::Union{Void,Bool,Signed,Unsigned,String}) =
    Const(val)

# Scalar functions.

Lift(fn, argtypes::Tuple{Vararg{Type}}, restype::Type, F::Combinator, Gs...) =
    Combinator() do q::Query
        it = ostub(q)
        q >> LiftQuery(fn, argtypes, restype, it >> F, (it >> convert(Combinator, G) for G in Gs)...)
    end

Lift(fn, argtypes::Tuple{Vararg{Type}}, F::Combinator, Gs...) =
    Combinator() do q::Query
        it = ostub(q)
        q >> LiftQuery(fn, argtypes, it >> F, (it >> convert(Combinator, G) for G in Gs)...)
    end

Lift(fn, F::Combinator, Gs...) =
    Combinator() do q::Query
        it = ostub(q)
        q >> LiftQuery(fn, it >> F, (it >> convert(Combinator, G) for G in Gs)...)
    end

.==(F::Combinator, G) = Lift(==, F, G)
.!=(F::Combinator, G) = Lift(!=, F, G)
.<(F::Combinator, G) = Lift(<, F, G)
.<=(F::Combinator, G) = Lift(<=, F, G)
.>(F::Combinator, G) = Lift(>, F, G)
.>=(F::Combinator, G) = Lift(>=, F, G)

(~)(F::Combinator) = Lift(~, F)
(&)(F::Combinator, Gs::Combinator...) = Lift(&, F, Gs...)
(|)(F::Combinator, Gs::Combinator...) = Lift(|, F, Gs...)

.+(F::Combinator, Gs...) = Lift(+, F, Gs...)
.-(F::Combinator, Gs...) = Lift(-, F, Gs...)
.*(F::Combinator, Gs...) = Lift(*, F, Gs...)
./(F::Combinator, Gs...) = Lift(/, F, Gs...)
.÷(F::Combinator, Gs...) = Lift(÷, F, Gs...)

# Aggregates.

Count(F::Combinator) =
    Combinator() do q::Query
        q >> CountQuery(ostub(q) >> F)
    end

const ThenCount =
    Combinator() do q::Query
        CountQuery(q) |> setnamespace(q.ns.db)
    end

Exists(F::Combinator) =
    Combinator() do q::Query
        q >> ExistsQuery(ostub(q) >> F)
    end

const ThenExists =
    Combinator() do q::Query
        ExistsQuery(q) |> setnamespace(q.ns.db)
    end

Aggregate(fn, argtype::Type, restype::Type, haszero::Bool, F::Combinator) =
    Combinator() do q::Query
        q >> AggregateQuery(fn, argtype, restype, haszero, ostub(q) >> F)
    end

Aggregate(fn, argtype::Type, restype::Type, F::Combinator) =
    Combinator() do q::Query
        q >> AggregateQuery(fn, argtype, restype, ostub(q) >> F)
    end

Aggregate(fn, argtype::Type, haszero::Bool, F::Combinator) =
    Combinator() do q::Query
        q >> AggregateQuery(fn, argtype, haszero, ostub(q) >> F)
    end

Aggregate(fn, argtype::Type, F::Combinator) =
    Combinator() do q::Query
        q >> AggregateQuery(fn, argtype, ostub(q) >> F)
    end

Aggregate(fn, haszero::Bool, F::Combinator) =
    Combinator() do q::Query
        q >> AggregateQuery(fn, haszero, ostub(q) >> F)
    end

Aggregate(fn, F::Combinator) =
    Combinator() do q::Query
        q >> AggregateQuery(fn, ostub(q) >> F)
    end

Aggregate(fn, argtype::Type, restype::Type, haszero::Bool) =
    F -> Aggregate(fn, argtype, restype, haszero, convert(Combinator, F))

Aggregate(fn, argtype::Type, restype::Type) =
    F -> Aggregate(fn, argtype, restype, convert(Combinator, F))

Aggregate(fn, argtype::Type, haszero::Bool) =
    F -> Aggregate(fn, argtype, haszero, convert(Combinator, F))

Aggregate(fn, argtype::Type) =
    F -> Aggregate(fn, argtype, convert(Combinator, F))

Aggregate(fn, haszero::Bool) =
    F -> Aggregate(fn, haszero, convert(Combinator, F))

Aggregate(fn) =
    F -> Aggregate(fn, convert(Combinator, F))

ThenAggregate(fn, argtype::Type, restype::Type, haszero::Bool) =
    Combinator() do q::Query
        AggregateQuery(fn, argtype, restype, haszero, q) |> setnamespace(q.ns.db)
    end

ThenAggregate(fn, argtype::Type, restype::Type) =
    Combinator() do q::Query
        AggregateQuery(fn, argtype, restype, q) |> setnamespace(q.ns.db)
    end

ThenAggregate(fn, argtype::Type, haszero::Bool) =
    Combinator() do q::Query
        AggregateQuery(fn, argtype, haszero, q) |> setnamespace(q.ns.db)
    end

ThenAggregate(fn, argtype::Type) =
    Combinator() do q::Query
        AggregateQuery(fn, argtype, q) |> setnamespace(q.ns.db)
    end

ThenAggregate(fn, haszero::Bool) =
    Combinator() do q::Query
        AggregateQuery(fn, haszero, q) |> setnamespace(q.ns.db)
    end

ThenAggregate(fn) =
    Combinator() do q::Query
        AggregateQuery(fn, q) |> setnamespace(q.ns.db)
    end

const AnyOf = Aggregate(any)
const AllOf = Aggregate(all)
const MaxOf = Aggregate(maximum, false)
const MinOf = Aggregate(minimum, false)
const SumOf = Aggregate(sum)
const MeanOf = Aggregate(mean)

const ThenAny = ThenAggregate(any)
const ThenAll = ThenAggregate(all)
const ThenMax = ThenAggregate(maximum, false)
const ThenMin = ThenAggregate(minimum, false)
const ThenSum = ThenAggregate(sum)
const ThenMean = ThenAggregate(mean)

# Filtering.

ThenFilter(P::Combinator) =
    Combinator() do q::Query
        FilterQuery(q, ostub(q) >> P) |> setnamespace(q.ns)
    end

# Sorting.

Sort(F::Combinator) =
    Combinator() do q::Query
        (q >> SortQuery(ostub(q) >> F)) |> setnamespace(q.ns)
    end

ThenSort(Fs::Combinator...) =
    Combinator() do q::Query
        it = ostub(q)
        SortQuery(q, (it >> F for F in Fs)...) |> setnamespace(q.ns)
    end

const Asc = ThenDecorate(:rev => false)
const Desc = ThenDecorate(:rev => true)

# Paginating.

ThenTake(N::Combinator) =
    Combinator() do q::Query
        TakeQuery(q, istub(q) >> N) |> setnamespace(q.ns)
    end

ThenSkip(N::Combinator) =
    Combinator() do q::Query
        SkipQuery(q, istub(q) >> N) |> setnamespace(q.ns)
    end

ThenTake(N) = ThenTake(convert(Combinator, N))
ThenSkip(N) = ThenSkip(convert(Combinator, N))

# Output.

ThenSelect(Fs::Combinator...) =
    Combinator() do q::Query
        it = ostub(q)
        compile(StaticBinding{:select}(), oscope(it), q, Query[it >> F for F in Fs])
    end

ThenSelect(Fs...) = ThenSelect((convert(Combinator, F) for F in Fs)...)

ThenSelect(;Fs...) = ThenSelect(Fs...)

ThenSummarize(Fs::Combinator...) =
    Combinator() do q::Query
        it = istub(q)
        compile(StaticBinding{:select}(), oscope(it), it, Query[q >> F for F in Fs])
    end

ThenSummarize(Fs...) = ThenSummarize((convert(Combinator, F) for F in Fs)...)

ThenSummarize(;Fs...) = ThenSummarize(Fs...)

# Hierarchical queries.

Connect(F::Combinator) =
    Combinator() do q::Query
        it = ostub(q)
        (q >> ConnectQuery(false, it >> F)) |> setnamespace(q.ns.db)
    end

# Grouping and roll-up.

ThenGroup(Fs::Combinator...) =
    Combinator() do q::Query
        it = ostub(q)
        compile(StaticBinding{:group}(), oscope(it), q, Query[it >> F for F in Fs])
    end

ThenGroup(Fs...) = ThenGroup((convert(Combinator, F) for F in Fs)...)

ThenGroup(;Fs...) = ThenGroup(Fs...)

ThenRollUp(Fs::Combinator...) =
    Combinator() do q::Query
        it = ostub(q)
        compile(StaticBinding{:rollup}(), oscope(it), q, Query[it >> F for F in Fs])
    end

ThenRollUp(Fs...) = ThenRollUp((convert(Combinator, F) for F in Fs)...)

ThenRollUp(;Fs...) = ThenRollUp(Fs...)

Unique(F::Combinator) =
    Combinator() do q::Query
        it = ostub(q)
        (q >> UniqueQuery(it >> F)) |> setnamespace(q.ns.db)
    end

const ThenUnique =
    Combinator() do q::Query
        UniqueQuery(q)
    end

# Parameters.

Parameter(tag::Symbol, oty) =
    Combinator() do q::Query
        (q >> SlotQuery(tag, oty)) |> setnamespace(q.ns.db)
    end

Given(Fs::Combinator...) =
    Combinator() do q::Query
        it = istub(q)
        GivenQuery(q, (it >> F for F in Fs)...) |> setnamespace(q.ns.db)
    end

Given(Fs...) = Given((convert(Combinator, F) for F in Fs)...)

Given(;Fs...) = Given(Fs...)

function Using(args::Combinator...)
    Q = args[end]
    Fs = args[1:end-1]
    Combinator() do q::Query
        it = ostub(q)
        r = it >> Q
        q >> GivenQuery(r, (it >> F for F in Fs)...) |> setnamespace(r.ns.db)
    end
end

Using(Fs...) = Using((convert(Combinator, F) for F in Fs)...)

# Before and around.

Before(Fs::Combinator...) =
    Combinator() do q::Query
        it = ostub(q)
        (q >> AroundQuery(domain(output(q)), true, true, false, (it >> F for F in Fs)...)) |> setnamespace(q.ns.db)
    end

Around(Fs::Combinator...) =
    Combinator() do q::Query
        it = ostub(q)
        (q >> AroundQuery(domain(output(q)), true, true, true, (it >> F for F in Fs)...)) |> setnamespace(q.ns.db)
    end

const ThenFrame =
    Combinator() do q::Query
        FrameQuery(q) |> setnamespace(q.ns)
    end

Frame(F::Combinator) =
    Combinator() do q::Query
        it = ostub(q)
        r = it >> F
        q >> FrameQuery(r) |> setnamespace(r.ns)
    end

# Cardinality assertions.

ExpectOne(F::Combinator) =
    Combinator() do q::Query
        it = ostub(q)
        r = it >> F
        q >> ExpectOneQuery(r) |> setnamespace(r.ns.db)
    end

ExpectAtMostOne(F::Combinator) =
    Combinator() do q::Query
        it = ostub(q)
        r = it >> F
        q >> ExpectAtMostOneQuery(r) |> setnamespace(r.ns.db)
    end

ExpectAtLeastOne(F::Combinator) =
    Combinator() do q::Query
        it = ostub(q)
        r = it >> F
        q >> ExpectAtLeastOneQuery(r) |> setnamespace(r.ns.db)
    end

const ThenExpectOne =
    Combinator() do q::Query
        ExpectOneQuery(q) |> setnamespace(q.ns.db)
    end

const ThenExpectAtMostOne =
    Combinator() do q::Query
        ExpectAtMostOneQuery(q) |> setnamespace(q.ns.db)
    end

const ThenExpectAtLeastOne =
    Combinator() do q::Query
        ExpectAtLeastOneQuery(q) |> setnamespace(q.ns.db)
    end

# Merging.

Merge(Fs::Combinator...) =
    Combinator() do q::Query
        it = ostub(q)
        q >> MergeQuery(Query[it >> F for F in Fs]) |> setnamespace(q.ns.db)
    end

# Multiplexing.

ThenElse(F::Combinator, G::Combinator) =
    Combinator() do q::Query
        it = ostub(q)
        IfThenElseQuery(q, it >> F, it >> G)
    end

Switch(T::Combinator, F::Combinator, G::Combinator) =
    Combinator() do q::Query
        it = ostub(q)
        t = it >> T
        f = it >> F
        g = it >> G
        q >> IfThenElseQuery(t, f, g)
    end

Switch(T::Combinator, F::Combinator, G::Combinator, H::Combinator, Ks::Combinator...) =
    Combinator() do q::Query
        it = ostub(q)
        t = it >> T
        f = it >> F
        g = it >> Switch(G, H, Ks...)
        q >> IfThenElseQuery(t, f, g)
    end

ExpectAnythingQuery(base::Query) = ExpectQuery(base, true, true)

ExpectAnything(F::Combinator) =
  Combinator() do q::Query
     it = ostub(q)
     q >> ExpectAnythingQuery(it >> F)
  end

FieldIfExists(tag::Symbol) =
    Combinator() do q::Query
        scope = oscope(q)
        maybe_binding = lookup(scope, tag, 0)
        if isnull(maybe_binding)
            return q
        end
        binding = get(maybe_binding)
        (q >> compile(binding, scope, Syntax[])) |> setnamespace(scope.db)
    end


text:
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateDownloadsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('downloads', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title');
            $table->string('arquivo');

            $table->string('photo')->nullable();

            $table->boolean('ativo');

            $table->longText('texto');
            $table->longText('sobre');

            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('downloads');
    }
}


text:
title: "Docker Patches"
---

# List of patches to Docker

Project Atomic includes the development and maintenance of a number of patches to the docker daemon and related tools.

All of the patches that we ship are described in the README.md file on the appropriate branch of [our docker  repository](https://github.com/projectatomic/docker).  If you want to look at the patches for docker-1.12 you would look at [the docker-1.12 branch](https://github.com/projectatomic/docker/tree/docker-1.12).

Each time docker creates a new version, we create a new branch in projectatomic with the version name to match.  The current master is working on docker-1.13.  You can see the current patchset on [the 1.13 branch](https://github.com/projectatomic/docker/tree/docker-1.13).

Patch types are:

* Red Hat: support compatibility with Red Hat Enterprise Linux and related tools.
* Upstream: Patches which were, or will be, submitted to mainstream docker.  Some have been rejected and are being maintained by the Atomic team.
* Backports: Patches which backport fixes from later versions of docker to earlier ones.

## Table of Patches

| Name               | Type               | PRs           | Status                      |
|--------------------|--------------------|---------------|-----------------------------|
| Add-RHEL-super-secrets-patch | Red Hat | [6075](https://github.com/docker/docker/pull/6075) | Maintaining |
| Add-add-registry-and-block-registry-options-to-docker | Upstream | [11991](https://github.com/docker/docker/pull/11991), [10411](https://github.com/docker/docker/pull/10411) | Rejected, Maintaining |
| Improved-searching-experience | Upstream | | Rejected, Maintaining |
| The-following-syscalls-should-not-be-blocked-by-seccomp | Upstream | [24221](https://github.com/docker/docker/pull/24221), [24510](https://github.com/docker/docker/pull/24510) | Rejected, Maintaining |
| Add-dockerhooks-exec-custom-hooks-for-prestart/poststop-containers | Upstream | [17021](https://github.com/docker/docker/pull/17021) | Pending |
| Return-rpm-version-of-packages-in-docker-version | Red Hat | [14591](https://github.com/docker/docker/pull/14591) | Maintaining |
| rebase-distribution-specific-build | Upstream | [15364](https://github.com/docker/docker/pull/15364) | Pending |
| System-logging-for-docker-daemon-API-calls | Upstream | [14446](https://github.com/docker/docker/pull/14446) | Blocked |
| Audit-logging-support-for-daemon-API-calls | Upstream | [109](https://github.com/rhatdan/docker/pull/109) | Blocked |
| Add-volume-support-to-docker-build | Upstream | See Below | See Below |

Patches which have been accepted by upstream docker are not represented in this chart.

A list of backport patches will be added to this page later.

## Longer Patch Descriptions

Project Atomic is carrying a series of patches that we feel are required for our users or for our support engineering.

### Add-RHEL-super-secrets-patch.patch

This patch allows us to provide subscription management information from the host into containers for both `docker run` and `docker build`.  In order to get access to RHEL7 and RHEL6 content inside of a container via yum you need to use a subscription.  This patch allows the subscriptions to work inside the container.  The docker upstream thought this was too RHEL specific so told us to carry a patch.

* [6075](https://github.com/docker/docker/pull/6075)

Note: This is our oldest patch.  Other distributions, like [SuSe](https://github.com/SUSE/docker.mirror/commit/76a4eb2f2e79d1abec07dfe33cd99c3d7a4568c3),  are carrying similar patches to allow the hosts subscriptions to be used inside the container to update distribution specific content.

### Add-add-registry-and-block-registry-options-to-docker.patch

Users have been asking for us to provide a mechanism to allow additional registries to be specified in addition to docker.io.  We also want to have Red Hat Content available from our Registry by default. This patch allows users to customize the default registries available.  We believe this closely aligns with the way yum and apt currently work.  This patch also allows users to block images from registries.  Some users do not want software
to be accidentally pulled and run on a machine.  Some users also have no access to the internet and want to setup private registries to handle their content.

* [11991](https://github.com/docker/docker/pull/11991)
* [10411](https://github.com/docker/docker/pull/10411)

**Status**: Upstream docker does not like this patch set, because they want the **docker** experience to be the same everywhere.  If I do a `docker pull fedora`, I always get it from docker.io.  We and our customers do not agree, so we continue to carry this patch.  We prefer the yum/apt method for specifying registries.

### Improved-searching-experience.patch

Red Hat wants to allow users to search multiple registries as described above. This patch improves the search experience.

**Status**:  This patch actually works with the Add-add-registry-and-block-registry-options-to-docke.patch so we need to carry it also.

### The-following-syscalls-should-not-be-blocked-by-seccomp.patch

Capabilities block these syscalls.

`mount`, `umount2`, `unshare`, `reboot` and `name\_to\_handle\_at` are all needed to run `systemd` as PID 1 in a container. These syscalls work fine without administrator privileges, sys_admin disabled.  These syscalls also provide features that do not require administrative access.  Blocking them by default breaks known work loads for little added security. There is no easy way to discover which syscalls are blocked, so we noticed that users that needed this functionality would simply run their containers without *any* security by using `--privileged`. We feel that adding the capability for `systemd` to run as PID 1 in the container, thereby allowing our users to run with security enabled, far outweighs the negatives for allowing these syscalls with seccomp.

With UserNamespace we want to allow users to potentially setup unshare additional namespaces.

From `man 2 reboot`:
...
Behavior inside PID namespaces
Since Linux 3.4, when reboot() is called from a PID namespace (see
        pid_namespaces(7)) other than the initial PID namespace, the effect
        of the call is to send a signal to the namespace "init" process.
        LINUX_REBOOT_CMD_RESTART and LINUX_REBOOT_CMD_RESTART2 cause a SIGHUP
        signal to be sent.  LINUX_REBOOT_CMD_POWER_OFF and
        LINUX_REBOOT_CMD_HALT cause a SIGINT signal to be sent.

* [21287](https://github.com/docker/docker/pull/21287)

**Status**: docker upstream says that systemd inside of a container is not something they want to support, so they do not want this patch merged.  They also claim some of these syscalls open up security risks like allowing unshare(USERNS) to containers.  They have pointed out that this syscall is not blocked by SYS_ADMIN capability, which means it could potentially lead to a privilege escalation.  Since these syscalls are available to non privileged users on most distributions, it is not seen as a big security issue, and some just break functionality like reboot above.  There are lots of other syscalls that are required by admin privs that could be blocked but are not  because they would break common workloads.  There is little difference between that approach and our patch if systemd is to be considered a common workload. Blocking the unshare syscall can actually weaken security since a container process could tighten its security using this syscall, which is not prevented.

We have a patch we are working with upstream docker to externalize the syscall whitelist file from the docker syscalls, this would allow distributions and admins to define their own list of syscalls to be used by default inside of containers. When this patch gets merged we can drop our patch and just ship distribution defaults.

* [24221](https://github.com/docker/docker/pull/24221)
* [24510](https://github.com/docker/docker/pull/24510)

### Add-dockerhooks-exec-custom-hooks-for-prestart/poststop-containers.patch

With the addition of runc/hooks support we want to add a feature to allow third parties to run helper programs before a docker container gets started and just after the container finishes.

For example we want to add a RegisterMachine hook.

For systems that support systemd/RegisterMachine, this hook would register a machine to the machinectl.  machinectl could then list docker containers along with other virtualization environments like kvm, and systemd-nspawn containers. Over time we would want to implement other machinectl features to get docker containers better integrated into the system.
Another example of a hook  is a log agent that records when a container starts and stops and then sends a message to a monitoring station.

Dockerhooks reads the `/usr/libexec/oci/hooks.d` directory to search for hooks, if the directory exists docker will execute the executables in this directory via runc/libcontainer is using PreStart and PostStop.  It will also send the config.json file as the second parameter.

**Status**: We hope that the upstream docker will expose this feature just like it makes use of these hooks for setting up networking in containers.  So far they haven't given users the option  to take advantage of these hooks.

* [17021](https://github.com/docker/docker/pull/17021)

### Return-rpm-version-of-packages-in-docker-version.patch

Red Hat Support wants to know the version of the rpm package that docker is running.  This patch allows the distribution to show the rpm version of the client and server using the `docker version` command.  The docker upstream was not interested in this patch. This patch only affects the `docker info` command.

* [14591](https://github.com/docker/docker/pull/14591)

**Status**:   Since this is distribution specific, docker has rejected the patch. But it is required for our support people to easily identify the client and server RPM of the patches in use, so we plan on carrying it.  This patch is also easy to maintain.

### rebase-distribution-specific-build.patch

Current upstream docker tests run totally on Debian.  We want to be able to make sure all tests run on platforms and containers we support.  This patch allows us to run distribution specific tests. This means that `make test` on RHEL7 will use RHEL7-based images for the test, and `make test` on Fedora will use Fedora-based images for the test.  The docker upstream was not crazy about the substitutions done in this patch, and the changes never show up in the version of the docker client/daemon that we ship.

* [15364](https://github.com/docker/docker/pull/15364)

**Status**: Up til now upstream docker does not like the way this works, not sure if there is a good way forward.   This patch set is really only for QA and does not change the way that docker works.

### System-logging-for-docker-daemon-API-calls.patch

Red Hat wants to log all access to the docker daemon.  This patch records all access to the docker daemon in syslog/journald.  Currently docker logs access in its event logs but these logs are not stored permanently and do not record critical information like loginuid to record which user created/started/stopped containers.  We will continue to work with the docker upstream to get this patch merged. The docker upstream indicates that they want to wait until the authentication patches get merged.

* [14446](https://github.com/docker/docker/pull/14446)

**Status**:  This patch is currently blocked because the docker CLI does not have anyway of authenticating the user doing the activity.  All docker currently logs when an activity happens is something like **root** started a container.  With this patch, we can actually log that **dwalsh** started a container, but this only works for local domain socket clients.  We are working with upstream on an [authentication patch](https://github.com/docker/docker/pull/20883) that can identify the user on the client initiating the action.  When/If that patch gets merged we will resubmit and attempt to get this patch merged.

### Audit-logging-support-for-daemon-API-calls.patch

This is a follow on patch to the previous syslog patch, to record all auditable events to the audit log.  We want to get `docker daemon` to some level of common criteria.  In order to do this administrator activity must be audited.

* [109](https://github.com/rhatdan/docker/pull/109)

**Status**: Similar to the System Logging patch, we need to wait for authentication patch gets merged before working this into docker upstream.

### Add-volume-support-to-docker-build.patch

This patch adds the ability to add bind mounts at build-time. This will be helpful in supporting builds with host files and secrets. The `--volume|-v flag` is added for this purpose. Trying to define a volume (ala docker run) errors out. Each bind mounts' mode will be read-only and it will preserve any SELinux label which was defined via the cli (`:[z,Z]`). Defining a read-write mode (`:rw`) will just print a warning in the build output and the actual mode will be
changed to read-only.

**Status**: Upstream docker has continuously blocked all efforts to support volumes in `docker build`.

These 2 below are open but no progress so far in years:

* [18603](https://github.com/docker/docker/issues/18603)
* [14080](https://github.com/docker/docker/issues/14080)

Closed proposals:

* [3949](https://github.com/docker/docker/issues/3949)
* [3156](https://github.com/docker/docker/issues/3156)
* [14251](https://github.com/docker/docker/issues/14251)

Up until now no satisfactory alternatives have arrived, but there are several projects working to build container images outside of docker, including [Ansible](http://docs.ansible.com/ansible/docker_image_module.html) and potentially [dockerramp](https://github.com/jlhawn/dockramp).