Re: [Sugar-devel] [PATCH sugar-datastore] don't choke if timestamp property is missing

2011-02-15 Thread Sascha Silbe
Excerpts from Simon Schampijer's message of Tue Feb 15 17:11:22 +0100 2011:

> Hmm, where does the ctime property actually comes from, is it a property 
> of the old DS?

Exactly.

> I think just doing the check as you have it and setting 
> "update_metadata" to true should be enough.

Good. I'll send an updated patch.

Sascha

-- 
http://sascha.silbe.org/
http://www.infra-silbe.de/


signature.asc
Description: PGP signature
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH sugar-datastore] don't choke if timestamp property is missing

2011-02-15 Thread Simon Schampijer

On 02/14/2011 03:52 PM, Sascha Silbe wrote:

Excerpts from Simon Schampijer's message of Mon Feb 14 21:01:18 +0100 2011:


So if the timestamp is missing we will create the entry with the current
timestamp when we update_the_index. I guess there is no better timestamp
we can set.


Exactly. I considered setting it to 0 instead, but the current time
seemed to be a marginally better fit.


Do we have other properties we should care about?


None that the data store itself requires in order to work properly
(except for those we already check for).


When restoring the other properties we set as well "update_metadata =
True", I think you have to do that here as well.


Yeah, good idea. creation_time might have been written before timestamp
(and the latter not landed on disk). Actually that gives me an idea:
We could try checking creation_time and ctime. I'm not sure the rare
case of timestamp missing is warranting the additional code complexity
of checking those two properties, though.


Hmm, where does the ctime property actually comes from, is it a property 
of the old DS?


I think just doing the check as you have it and setting 
"update_metadata" to true should be enough.


Regards,
   Simon

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH sugar-datastore] don't choke if timestamp property is missing

2011-02-14 Thread Sascha Silbe
Excerpts from Simon Schampijer's message of Mon Feb 14 21:01:18 +0100 2011:

> So if the timestamp is missing we will create the entry with the current 
> timestamp when we update_the_index. I guess there is no better timestamp 
> we can set.

Exactly. I considered setting it to 0 instead, but the current time
seemed to be a marginally better fit.

> Do we have other properties we should care about?

None that the data store itself requires in order to work properly
(except for those we already check for).

> When restoring the other properties we set as well "update_metadata = 
> True", I think you have to do that here as well.

Yeah, good idea. creation_time might have been written before timestamp
(and the latter not landed on disk). Actually that gives me an idea:
We could try checking creation_time and ctime. I'm not sure the rare
case of timestamp missing is warranting the additional code complexity
of checking those two properties, though.

Sascha

-- 
http://sascha.silbe.org/
http://www.infra-silbe.de/


signature.asc
Description: PGP signature
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH sugar-datastore] don't choke if timestamp property is missing

2011-02-14 Thread Simon Schampijer

On 02/11/2011 07:50 AM, Sascha Silbe wrote:

The timestamp property might be missing due to incomplete writes (out of
power, system crash) or software bugs.


So if the timestamp is missing we will create the entry with the current 
timestamp when we update_the_index. I guess there is no better timestamp 
we can set.


Do we have other properties we should care about?

When restoring the other properties we set as well "update_metadata = 
True", I think you have to do that here as well.


Regards,
   Simon



Signed-off-by: Sascha Silbe
---
  src/carquinyol/datastore.py |2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/carquinyol/datastore.py b/src/carquinyol/datastore.py
index 837de35..12458fb 100644
--- a/src/carquinyol/datastore.py
+++ b/src/carquinyol/datastore.py
@@ -140,6 +140,8 @@ class DataStore(dbus.service.Object):
  if os.path.exists(path):
  props['filesize'] = os.stat(path).st_size
  update_metadata = True
+if 'timestamp' not in props:
+props['timestamp'] = str(int(time.time()))
  if 'creation_time' not in props:
  if 'ctime' in props:
  try:


___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH sugar-datastore] don't choke if timestamp property is missing

2011-02-11 Thread Sascha Silbe
The timestamp property might be missing due to incomplete writes (out of
power, system crash) or software bugs.

Signed-off-by: Sascha Silbe 
---
 src/carquinyol/datastore.py |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/carquinyol/datastore.py b/src/carquinyol/datastore.py
index 837de35..12458fb 100644
--- a/src/carquinyol/datastore.py
+++ b/src/carquinyol/datastore.py
@@ -140,6 +140,8 @@ class DataStore(dbus.service.Object):
 if os.path.exists(path):
 props['filesize'] = os.stat(path).st_size
 update_metadata = True
+if 'timestamp' not in props:
+props['timestamp'] = str(int(time.time()))
 if 'creation_time' not in props:
 if 'ctime' in props:
 try:
-- 
1.7.2.3

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel