ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/DecentralizedMedia/Share.cpp
Revision: 540
Committed: 2005-07-01T23:56:04-07:00 (19 years, 11 months ago) by douglas
File size: 706 byte(s)
Log Message:
Ketchup and locking!

File Contents

# User Rev Content
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 540 Share::Share(const _P<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 535 cse::String address, port;
19 douglas 514
20 douglas 535 host.ToString(address, port);
21    
22     api::Path host_(shares.GetRealPath().GetChild(address));
23    
24 douglas 514 if (!host_.Exists())
25 douglas 529 host_.CreateDirectory();
26 douglas 514
27     path = host_.GetChild(share);
28    
29     if (!path.Exists())
30 douglas 529 path.CreateDirectory();
31 douglas 514 }
32    
33 douglas 534 Share::~Share()
34 douglas 514 {
35     connection->Parse(_B("UPDATE files SET live = FALSE WHERE root = ?"))->Execute(path.GetPath());
36     }

Properties

Name Value
svn:eol-style native
svn:keywords Id