ValidateUsers() public static method

public static ValidateUsers ( ) : void
return void
Beispiel #1
0
        public virtual async Task Track(
            string eventName,
            ActivityDrilldown drilldown,
            DateTime timestamp,
            bool publishable,
            params long[] users)
        {
            Validation.ValidateEventName(eventName);
            Validation.ValidateUsers(users);

            string channel = null;

            byte[] payload = null;

            var timeframeKeys = GenerateEventTimeframeKeys(
                eventName,
                drilldown,
                timestamp).ToList();

            var eventsKey = GenerateKey();

            var db    = Settings.Db;
            var tasks = new List <Task>();

            if (publishable)
            {
                channel = eventsKey +
                          Settings.KeySeparator +
                          eventName.ToUpperInvariant();

                payload = new UserActivitySubscriptionInfo
                {
                    EventName = eventName,
                    Timestamp = timestamp,
                    Users     = users
                }.Serialize();
            }

            using (var connection = await ConnectionFactories.Open())
            {
                foreach (var timeframeKey in timeframeKeys)
                {
                    tasks.AddRange(users.Select(user =>
                                                connection.Strings.SetBit(
                                                    db,
                                                    timeframeKey,
                                                    user,
                                                    true)));
                }

                tasks.Add(connection.Sets.Add(db, eventsKey, eventName));

                await Task.WhenAll(tasks);

                if (publishable)
                {
                    await connection.Publish(channel, payload);
                }
            }
        }
        public virtual async Task <bool[]> Includes(params long[] users)
        {
            Validation.ValidateUsers(users);

            using (var connection = await ConnectionFactories.Open())
            {
                return(await InternalIncludes(connection, users));
            }
        }
Beispiel #3
0
        public override async Task <bool[]> Includes(params long[] users)
        {
            Validation.ValidateUsers(users);

            using (var connection = await ConnectionFactories.Open())
            {
                await PerformBitOperation(connection);

                return(await InternalIncludes(connection, users));
            }
        }