X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdatabase%2FPostProvider.java;h=7d5437a873adb522648b43bdde392cd6acdeaf24;hb=667a3a2d8544cf91f00baba1aaf9f55cead7d006;hp=865376bf31e4e01b3a1f12f1b76f4c1b0119c30a;hpb=658a702c550e15bd3c868ed399621606eeb4ef20;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/database/PostProvider.java b/src/main/java/net/pterodactylus/sone/database/PostProvider.java index 865376b..7d5437a 100644 --- a/src/main/java/net/pterodactylus/sone/database/PostProvider.java +++ b/src/main/java/net/pterodactylus/sone/database/PostProvider.java @@ -20,12 +20,17 @@ package net.pterodactylus.sone.database; import java.util.Collection; import net.pterodactylus.sone.data.Post; +import net.pterodactylus.sone.database.memory.MemoryDatabase; + +import com.google.common.base.Optional; +import com.google.inject.ImplementedBy; /** * Interface for objects that can provide {@link Post}s by their ID. * * @author David ‘Bombe’ Roden */ +@ImplementedBy(MemoryDatabase.class) public interface PostProvider { /** @@ -35,7 +40,16 @@ public interface PostProvider { * The ID of the post to return * @return The post with the given ID, or {@code null} */ - public Post getPost(String postId); + public Optional getPost(String postId); + + /** + * Returns all posts from the given Sone. + * + * @param soneId + * The ID of the Sone + * @return All posts from the given Sone + */ + public Collection getPosts(String soneId); /** * Returns all posts that have the given Sone as recipient.