redis源码从头深入分析(1)--acl文件

此篇为对redis源码的个人理解和分析,以一个初看源码的视角从头阅读源码,对各个函数,定义的类型进行解释并阐明其作用,让初读源码的人能够完全理解该定义类型及函数,最后形成对redis总体的一个认知。希望此篇能为初读redis源码的人提供一些帮助。

acl.c文件

acl是 Access Control List的缩写,即访问控制列表,一个允许一些连接在可以执行的命令和可以访问的键方面受到限制的功能,具体redis官方文档中有:ACL | Redis

首先文件开头给出了各个类型的定义,acl文件开头提到如下定义:

rax *Users; /* Table mapping usernames to user structures. */

user *DefaultUser;  /* Global reference to the default user.
                       Every new connection is associated to it, if no
                       AUTH or HELLO is used to authenticate with a
                       different user. */

list *UsersToLoad;  /* This is a list of users found in the configuration file
                       that we'll need to load in the final stage of Redis
                       initialization, after all the modules are already
                       loaded. Every list element is a NULL terminated
                       array of SDS pointers: the first is the user name,
                       all the remaining pointers are ACL rules in the same
                       format as ACLSetUser(). */
list *ACLLog;       /* Our security log, the user is able to inspect that
                       using the ACL LOG command .*/

static rax *commandId = NULL; /* Command name to id mapping */

static unsigned long nextid = 0; /* Next command id that has not been assigned */

定义了Users;Default

你可能感兴趣的:(redis源码,redis,数据库,缓存)