|  11-21-2021, 09:56 AM | #1 | 
| Groupie            Posts: 173 Karma: 1497966 Join Date: Jul 2021 Device: N/A | 
				
				[Plugin] How to delete a checkpoint?
			 
			
			Hi,  In a plugin, is there any way to delete a checkpoint by it's name, without action on the container? I would like to do something like this: Code: for i, some_action in enumerate(actions):
	point_name = 'partial checkpoint n. {}'.format(i)
	self.boss.add_savepoint(point_name)
	some_action()	# user get a win-diff and may rewind_savepoint() or not
        # if still existing, just delete our CP with no rewind action,
        # as it's not needeed anymore:
	self.boss.delete_savepoint(point_name)By the way, is the creation of checkpoints a memory consuming process? Does it have much impact on the performances ? Thank you. Last edited by lomkiri; 11-21-2021 at 10:00 AM. | 
|   |   | 
|  11-21-2021, 09:59 AM | #2 | 
| creator of calibre            Posts: 45,604 Karma: 28548974 Join Date: Oct 2006 Location: Mumbai, India Device: Various | 
			
			No, checkpoints dont have names. They just have some descriptive text which is not guaranteed to be unique. If you want to perform lots of operations its best to just create a checkpoint before the whole set.  And no checkpoints are stored on disk not in ram and creating them is very cheap as they use copy-on-write and hard links. | 
|   |   | 
| Advert | |
|  | 
|  11-21-2021, 10:08 AM | #3 | 
| Groupie            Posts: 173 Karma: 1497966 Join Date: Jul 2021 Device: N/A | 
			
			Thank you , Kovid ! It's annoying because I would need granularity: the user will have the possibility to interpose personal changes in the ebook between two "some_action" and I would like not to revert those ones. It is not possible either to delete the last one, with no rewind action ? The limit is effectively 100 ? What happens if we reach this limit ? CP is not created, or first ones are deleted, or an exception is raised ? Last edited by lomkiri; 11-21-2021 at 10:11 AM. | 
|   |   | 
|  11-21-2021, 10:21 AM | #4 | 
| creator of calibre            Posts: 45,604 Karma: 28548974 Join Date: Oct 2006 Location: Mumbai, India Device: Various | 
			
			You can rewind the last checkpoint with rewind_savepoint(). And if you exceed the limit old checkpoints are removed.
		 | 
|   |   | 
|  11-21-2021, 10:57 AM | #5 | 
| Groupie            Posts: 173 Karma: 1497966 Join Date: Jul 2021 Device: N/A | 
			
			Ok, thanks. I'll do as you said and generate more generalistic CPs. The confirm box will warn the user that rewinding will also undo his own changes.
		 | 
|   |   | 
| Advert | |
|  | 
|  | 
| Tags | 
| checkpoint, plugin | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| [REQ] A plugin that delete class in the chapter | Auramazda | Plugins | 14 | 09-21-2016 10:57 AM | 
| Using "Delete Duplicates" Plugin | Beemerang | Plugins | 3 | 10-30-2014 02:04 AM | 
| Q: Should [Delete File] also delete <link>? | phossler | Editor | 5 | 01-02-2014 04:38 AM | 
| Is there a plugin that will search a library to delete the ORIGINAL_EPUB files | LadyKate | Library Management | 4 | 11-09-2013 09:02 PM | 
| Delete files in PC not equal to delete in Sony reader 505 | sheilalayoli | Sony Reader | 5 | 07-12-2009 03:13 PM |