1 |
douglas |
514 |
// Share |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
douglas |
516 |
#include <menes/standard.hh> |
8 |
douglas |
514 |
|
9 |
douglas |
516 |
#include "Share.hpp" |
10 |
|
|
|
11 |
douglas |
534 |
Share::Share(const _H<dbi::Connection>& connection, const api::Address& host, const cse::String& share) : connection(connection), host(host), share(share) |
12 |
douglas |
514 |
{ |
13 |
douglas |
529 |
api::Path shares(_B("Shares")); |
14 |
douglas |
514 |
|
15 |
|
|
if (!shares.Exists()) |
16 |
douglas |
529 |
shares.CreateDirectory(); |
17 |
douglas |
514 |
|
18 |
douglas |
534 |
api::Path host_(shares.GetRealPath().GetChild(/*lexical_cast<cse::String>(host)*/_B("192.168.1.8"))); |
19 |
douglas |
514 |
|
20 |
|
|
if (!host_.Exists()) |
21 |
douglas |
529 |
host_.CreateDirectory(); |
22 |
douglas |
514 |
|
23 |
|
|
path = host_.GetChild(share); |
24 |
|
|
|
25 |
|
|
if (!path.Exists()) |
26 |
douglas |
529 |
path.CreateDirectory(); |
27 |
douglas |
514 |
} |
28 |
|
|
|
29 |
douglas |
534 |
Share::~Share() |
30 |
douglas |
514 |
{ |
31 |
|
|
connection->Parse(_B("UPDATE files SET live = FALSE WHERE root = ?"))->Execute(path.GetPath()); |
32 |
|
|
} |