s/insert/put/

This commit is contained in:
bert hubert 2018-12-16 21:46:53 +01:00
parent 654e782b5f
commit 3277381170
2 changed files with 19 additions and 18 deletions

View File

@ -96,43 +96,43 @@ int main()
rr.domain_id=11; rr.qtype = 5; rr.ttl = 3600; rr.qname = "www.powerdns.com"; rr.ordername = "www";
rr.content = "powerdns.com";
auto id = txn.insert(rr);
cout<<"Inserted as id "<<id<<endl;
auto id = txn.put(rr);
cout<<"Puted as id "<<id<<endl;
rr.qname = "powerdns.com"; rr.qtype = 1; rr.ordername=""; rr.content = "1.2.3.4";
id = txn.insert(rr);
cout<<"Inserted as id "<<id<<endl;
id = txn.put(rr);
cout<<"Puted as id "<<id<<endl;
rr.qtype = 2; rr.content = "ns1.powerdns.com"; rr.ordername = "ns1";
id = txn.insert(rr);
cout<<"Inserted as id "<<id<<endl;
id = txn.put(rr);
cout<<"Puted as id "<<id<<endl;
rr.content = "ns2.powerdns.com"; rr.ordername = "ns2"; id = txn.insert(rr);
cout<<"Inserted as id "<<id<<endl;
rr.content = "ns2.powerdns.com"; rr.ordername = "ns2"; id = txn.put(rr);
cout<<"Puted as id "<<id<<endl;
rr.qname = "www.ds9a.nl"; rr.domain_id = 10; rr.content = "1.2.3.4"; rr.qtype = 1;
rr.ordername="www";
txn.insert(rr);
txn.put(rr);
rr.qname = "ds9a.nl"; rr.content = "ns1.ds9a.nl bert.ds9a.nl 1"; rr.qtype = 6;
rr.ordername="";
txn.insert(rr);
txn.put(rr);
rr.qname = "ds9a.nl"; rr.content = "25 ns1.ds9a.nl"; rr.qtype = 15;
txn.insert(rr);
txn.put(rr);
rr.qname = "ns1.ds9a.nl"; rr.content = "1.2.3.4"; rr.qtype = 1;
rr.ordername="ns1";
txn.insert(rr);
txn.put(rr);
rr.qname = "ns1.ds9a.nl"; rr.content = "::1"; rr.qtype = 26;
txn.insert(rr);
txn.put(rr);
rr.qname = "ns2.ds9a.nl"; rr.content = "1.2.3.4"; rr.qtype = 1;
rr.ordername="ns2";
txn.insert(rr);
txn.put(rr);
rr.qname = "ns2.ds9a.nl"; rr.content = "::1"; rr.qtype = 26;
txn.insert(rr);
txn.put(rr);

View File

@ -20,10 +20,11 @@ using std::endl;
Everything should go into a namespace
What is an error? What is an exception?
could id=0 be magic? ('no such id')
Insert? Put? Naming matters
Is boost the best serializer?
Perhaps use the separate index concept from multi_index
A dump function would be nice (typed)
including indexes
perhaps get eiter to be of same type so for(auto& a : x) works
*/
@ -452,7 +453,7 @@ public:
}
// insert something, with possibly a specific id
uint32_t insert(const T& t, uint32_t id=0)
uint32_t put(const T& t, uint32_t id=0)
{
if(!id)
id = getMaxID(d_txn, d_parent->d_main) + 1;
@ -477,7 +478,7 @@ public:
func(t);
del(id); // this is the lazy way. We could test for changed index fields
insert(t, id);
put(t, id);
}
//! delete an item, and from indexes