Path: blob/main/contrib/kyua/store/write_transaction.hpp
39478 views
// Copyright 2011 The Kyua Authors.1// All rights reserved.2//3// Redistribution and use in source and binary forms, with or without4// modification, are permitted provided that the following conditions are5// met:6//7// * Redistributions of source code must retain the above copyright8// notice, this list of conditions and the following disclaimer.9// * Redistributions in binary form must reproduce the above copyright10// notice, this list of conditions and the following disclaimer in the11// documentation and/or other materials provided with the distribution.12// * Neither the name of Google Inc. nor the names of its contributors13// may be used to endorse or promote products derived from this software14// without specific prior written permission.15//16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.2728/// \file store/write_transaction.hpp29/// Implementation of write-only transactions on the backend.3031#if !defined(STORE_WRITE_TRANSACTION_HPP)32#define STORE_WRITE_TRANSACTION_HPP3334#include "store/write_transaction_fwd.hpp"3536extern "C" {37#include <stdint.h>38}3940#include <memory>41#include <string>4243#include "model/context_fwd.hpp"44#include "model/test_program_fwd.hpp"45#include "model/test_result_fwd.hpp"46#include "store/write_backend_fwd.hpp"47#include "utils/datetime_fwd.hpp"48#include "utils/fs/path_fwd.hpp"49#include "utils/optional_fwd.hpp"5051namespace store {525354/// Representation of a write-only transaction.55///56/// Transactions are the entry place for high-level calls that access the57/// database.58class write_transaction {59struct impl;6061/// Pointer to the shared internal implementation.62std::shared_ptr< impl > _pimpl;6364friend class write_backend;65write_transaction(write_backend&);6667public:68~write_transaction(void);6970void commit(void);71void rollback(void);7273void put_context(const model::context&);74int64_t put_test_program(const model::test_program&);75int64_t put_test_case(const model::test_program&, const std::string&,76const int64_t);77utils::optional< int64_t > put_test_case_file(const std::string&,78const utils::fs::path&,79const int64_t);80int64_t put_result(const model::test_result&, const int64_t,81const utils::datetime::timestamp&,82const utils::datetime::timestamp&);83};848586} // namespace store8788#endif // !defined(STORE_WRITE_TRANSACTION_HPP)899091