blob: 63a5db6d7f63b8ae6e58a22663df9dbbe891f862 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
package io.dico.parcels2.storage
import io.dico.parcels2.*
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.Job
import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.channels.SendChannel
import org.joda.time.DateTime
import java.util.UUID
import kotlin.coroutines.CoroutineContext
interface Backing {
val name: String
val isConnected: Boolean
val coroutineContext: CoroutineContext
fun launchJob(job: Backing.() -> Unit): Job
fun <T> launchFuture(future: Backing.() -> T): Deferred<T>
fun <T> openChannel(future: Backing.(SendChannel<T>) -> Unit): ReceiveChannel<T>
fun <T> openChannelForWriting(future: Backing.(T) -> Unit): SendChannel<T>
fun init()
fun shutdown()
fun getWorldCreationTime(worldId: ParcelWorldId): DateTime?
fun setWorldCreationTime(worldId: ParcelWorldId, time: DateTime)
fun getPlayerUuidForName(name: String): UUID?
fun updatePlayerName(uuid: UUID, name: String)
fun transmitParcelData(channel: SendChannel<DataPair>, parcels: Sequence<ParcelId>)
fun transmitAllParcelData(channel: SendChannel<DataPair>)
fun readParcelData(parcel: ParcelId): ParcelDataHolder?
fun getOwnedParcels(user: PlayerProfile): List<ParcelId>
fun getNumParcels(user: PlayerProfile): Int = getOwnedParcels(user).size
fun setParcelData(parcel: ParcelId, data: ParcelDataHolder?)
fun setParcelOwner(parcel: ParcelId, owner: PlayerProfile?)
fun setParcelOwnerSignOutdated(parcel: ParcelId, outdated: Boolean)
fun setLocalPrivilege(parcel: ParcelId, player: PlayerProfile, privilege: Privilege)
fun setParcelOptionsInteractConfig(parcel: ParcelId, config: InteractableConfiguration)
fun transmitAllGlobalPrivileges(channel: SendChannel<PrivilegePair<PlayerProfile>>)
fun readGlobalPrivileges(owner: PlayerProfile): PrivilegesHolder?
fun setGlobalPrivilege(owner: PlayerProfile, player: PlayerProfile, privilege: Privilege)
}
|