C# Get Time from Network Attached Storage on Small LAN -
i don't know if can done or not, please patient me. first describe environment.
we have 8 laptops used offline work in stand-alone access database. have large wired router. nas drive connected router. when laptop users come in field, connect laptops router. front-end access database c# program. master copy of database exists on nas. lan not connected internet.
when users connect laptops lan, want full sync occur. so, new records exist on nas database downloaded laptops. new records have created on laptops uploaded nas.
all primary keys guid's. have added datetime field each table. anytime record in table added or changed, timestamp updated. no records ever deleted.
each users laptop know datetime of last snc. download users laptop records timestamp newer last sync. upload nas based on time well.
so, cannot guarantee users laptops time synced each other. these laptops never connected internet or server. not want use times users laptops record timestamps. want time come nas if possible. if know mac address or ip address of nas, possible query current time nas? feasible? if so, can point me in right direction?
don't use time because horrible analog you're after. time can go backwards, time can inaccurate, can changed user. if use time nas box, can still mess.
what you're after form of transaction system, akin git does.
if you're willing store field per record, why not store sort of commit id? i'd have 2 columns - global commit id , local commit id.
the global commit id stores database record's last commit id when synced nas. local commit id stores changes made record client.
- nas starts empty.
- client1 syncs empty nas.
- client1 initializes local commit id each record copying global commit id record.
- client1 goes offline.
- client1 changes record, , increments local commit id.
- client1 attaches nas.
- client1 examines copy of database - sees record has local commit id greater global commit id record in copy of database (this not nas's version of global commit id).
- client1 sends record nas database.
- client1 updates copy of global commit id record in local copy.
- nas increments global commit id record.
- client1 scans nas database records have global commit id greater client's global commit id, updating these records in local copy of database.
Comments
Post a Comment