chore: auto-commit (13 archivos)
- CMakeLists.txt - agent_protocol.cpp - agent_protocol.h - app.md - appicon.ico - hosts_db.cpp - hosts_db.h - http_client.cpp - http_client.h - main.cpp - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
struct sqlite3;
|
||||
|
||||
namespace pex {
|
||||
|
||||
struct Host {
|
||||
int64_t id = 0;
|
||||
std::string name;
|
||||
std::string url;
|
||||
std::string token;
|
||||
std::string os; // "linux" | "windows" | "wsl"
|
||||
int64_t last_seen_unix = 0;
|
||||
bool is_local = false;
|
||||
};
|
||||
|
||||
class HostsDb {
|
||||
public:
|
||||
HostsDb();
|
||||
~HostsDb();
|
||||
|
||||
// path debe ser absoluto (fn::local_path("hosts.db")).
|
||||
bool open(const std::string& path);
|
||||
void close();
|
||||
|
||||
std::vector<Host> list();
|
||||
int64_t upsert(const Host& h); // devuelve id; -1 si falla
|
||||
bool remove(int64_t id);
|
||||
bool touch_last_seen(int64_t id, int64_t unix_ts);
|
||||
|
||||
private:
|
||||
sqlite3* db_ = nullptr;
|
||||
};
|
||||
|
||||
} // namespace pex
|
||||
Reference in New Issue
Block a user