Moved Roles out of the primary data store
This commit is contained in:
@@ -1,14 +1,12 @@
|
|||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Discord.WebSocket.Data
|
namespace Discord.WebSocket.Data
|
||||||
{
|
{
|
||||||
public class DefaultDataStore : IDataStore
|
public class DefaultDataStore : IDataStore
|
||||||
{
|
{
|
||||||
private const double AverageChannelsPerGuild = 10.22; //Source: Googie2149
|
private const double AverageChannelsPerGuild = 10.22; //Source: Googie2149
|
||||||
private const double AverageRolesPerGuild = 5; //Source: Googie2149 //TODO: Get a real value
|
|
||||||
private const double AverageUsersPerGuild = 47.78; //Source: Googie2149
|
private const double AverageUsersPerGuild = 47.78; //Source: Googie2149
|
||||||
private const double CollectionMultiplier = 1.05; //Add buffer to handle growth
|
private const double CollectionMultiplier = 1.05; //Add buffer to handle growth
|
||||||
private const double CollectionConcurrencyLevel = 1; //WebSocket updater/event handler. //TODO: Needs profiling, increase to 2?
|
private const double CollectionConcurrencyLevel = 1; //WebSocket updater/event handler. //TODO: Needs profiling, increase to 2?
|
||||||
@@ -27,7 +25,6 @@ namespace Discord.WebSocket.Data
|
|||||||
{
|
{
|
||||||
_channels = new ConcurrentDictionary<ulong, Channel>(1, (int)((guildCount * AverageChannelsPerGuild + dmChannelCount) * CollectionMultiplier));
|
_channels = new ConcurrentDictionary<ulong, Channel>(1, (int)((guildCount * AverageChannelsPerGuild + dmChannelCount) * CollectionMultiplier));
|
||||||
_guilds = new ConcurrentDictionary<ulong, Guild>(1, (int)(guildCount * CollectionMultiplier));
|
_guilds = new ConcurrentDictionary<ulong, Guild>(1, (int)(guildCount * CollectionMultiplier));
|
||||||
_roles = new ConcurrentDictionary<ulong, Role>(1, (int)(guildCount * AverageRolesPerGuild * CollectionMultiplier));
|
|
||||||
_users = new ConcurrentDictionary<ulong, User>(1, (int)(guildCount * AverageUsersPerGuild * CollectionMultiplier));
|
_users = new ConcurrentDictionary<ulong, User>(1, (int)(guildCount * AverageUsersPerGuild * CollectionMultiplier));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ namespace Discord.WebSocket.Data
|
|||||||
{
|
{
|
||||||
IEnumerable<Channel> Channels { get; }
|
IEnumerable<Channel> Channels { get; }
|
||||||
IEnumerable<Guild> Guilds { get; }
|
IEnumerable<Guild> Guilds { get; }
|
||||||
IEnumerable<Role> Roles { get; }
|
|
||||||
IEnumerable<User> Users { get; }
|
IEnumerable<User> Users { get; }
|
||||||
|
|
||||||
Channel GetChannel(ulong id);
|
Channel GetChannel(ulong id);
|
||||||
@@ -17,10 +16,6 @@ namespace Discord.WebSocket.Data
|
|||||||
void AddGuild(Guild guild);
|
void AddGuild(Guild guild);
|
||||||
Guild RemoveGuild(ulong id);
|
Guild RemoveGuild(ulong id);
|
||||||
|
|
||||||
Role GetRole(ulong id);
|
|
||||||
void AddRole(Role role);
|
|
||||||
Role RemoveRole(ulong id);
|
|
||||||
|
|
||||||
User GetUser(ulong id);
|
User GetUser(ulong id);
|
||||||
void AddUser(User user);
|
void AddUser(User user);
|
||||||
User RemoveUser(ulong id);
|
User RemoveUser(ulong id);
|
||||||
|
|||||||
Reference in New Issue
Block a user