LocalCollection.kt 1.1 KB
Newer Older
1
/*
Ricki Hirner's avatar
Ricki Hirner committed
2
 * Copyright © Ricki Hirner (bitfire web engineering).
3 4 5 6 7 8 9 10
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 */

package at.bitfire.davdroid.resource

11
import at.bitfire.davdroid.model.SyncState
12 13 14

interface LocalCollection<out T: LocalResource> {

15 16 17 18
    /** collection title (used for user notifications etc.) **/
    val title: String
    /** unique ID, used to distinguish notifications for different collections **/
    val uniqueId: String
19

20
    var lastSyncState: SyncState?
21

22 23
    fun findDeleted(): List<T>
    fun findDirty(): List<T>
24

25
    fun findByName(name: String): T?
26 27


28 29 30 31 32 33 34 35 36 37 38
    /**
     * Marks all entries which are not dirty with the given flags only.
     * @return number of marked entries
     **/
    fun markNotDirty(flags: Int): Int

    /**
     * Removes all entries with are not dirty and are marked with exactly the given flags.
     * @return number of removed entries
     */
    fun removeNotDirtyMarked(flags: Int): Int
39 40

}