act-cluster-lib/include/db_artifact.hpp

90 lines
No EOL
2.8 KiB
C++

/*************************************************************************
*
* Copyright (c) 2023 Fabian Posch
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
**************************************************************************
*/
#ifndef __DB_ARTIFACT__
#define __DB_ARTIFACT__
/**
* @brief Data used for a partial artifact from the database
*
* Don't let this confuse you. This is the additional data one would get when
* pulling a (partial) artifact from the database.
*
* Database information is intentionally kept out of the artifact library, since this
* is not needed for local artifact processing (especially in the deploy tool).
*
* Since an agent might have special requirements in regards to additional information,
* no specific implementation is provided by this library.
*
* Combinations of specific artifact types should therefor implemented locally.
* This is just the minimal cross-section of what an agent will have to deal with.
*
*/
#include "db_types.hpp"
class DBArtifact {
public:
/**
* @brief Construct a new Artifact with a database UUID attached to it.
*
* This should be used when downloading the artifact from the database.
* This ID is actually required when an update in the database is required.
*
* @param id
*/
DBArtifact(const db::uuid_t& id, const db::uuid_t& source_pass, const db::uuid_t& target_artifact);
/**
* @brief The ID of this object in the database
*
* The ID should be auto-generated when this task is fetched from the database.
* It is generated automatically by said database.
*
* The new partial artifact must be generated immediately to indicate someone
* working on this.
*
*/
const db::uuid_t& id = id_;
/**
* @brief The ID of the pass in the database which created this object
*/
const db::uuid_t& source_pass = source_pass_;
/**
* @brief The artifact, which this partial artifact is a part of
*/
const db::uuid_t& target_artifact = target_artifact_;
protected:
db::uuid_t id_;
db::uuid_t source_pass_;
db::uuid_t target_artifact_;
};
#endif