Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (22 sloc) 552 Bytes
package main.scala.node
import main.scala.data.Data
import main.scala.util.MixableActor
trait User extends MixableActor {
val files = scala.collection.mutable.Set[Data]()
receive ({
case ("die") =>
exit()
case ("share", file: Data) =>
store(file)
case ("unshare", file: Data) =>
unstore(file)
}: PartialFunction[Any, Unit])
protected def store(file: Data) {
assert(!(files contains file))
files += file
}
protected def unstore(file: Data) {
assert(files contains file)
files -= file
}
}