aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/symcache/symcache_internal.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/libserver/symcache/symcache_internal.hxx')
-rw-r--r--src/libserver/symcache/symcache_internal.hxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libserver/symcache/symcache_internal.hxx b/src/libserver/symcache/symcache_internal.hxx
index 9bce37532..063777a71 100644
--- a/src/libserver/symcache/symcache_internal.hxx
+++ b/src/libserver/symcache/symcache_internal.hxx
@@ -34,7 +34,7 @@
#include "rspamd_symcache.h"
#include "contrib/libev/ev.h"
-#include "contrib/robin-hood/robin_hood.h"
+#include "contrib/ankerl/unordered_dense.h"
#include "contrib/expected/expected.hpp"
#include "cfg_file.h"
@@ -109,9 +109,9 @@ struct order_generation {
/* All items ordered */
std::vector<cache_item_ptr> d;
/* Mapping from symbol name to the position in the order array */
- robin_hood::unordered_flat_map<std::string_view, unsigned int> by_symbol;
+ ankerl::unordered_dense::map<std::string_view, unsigned int> by_symbol;
/* Mapping from symbol id to the position in the order array */
- robin_hood::unordered_flat_map<unsigned int, unsigned int> by_cache_id;
+ ankerl::unordered_dense::map<unsigned int, unsigned int> by_cache_id;
/* It matches cache->generation_id; if not, a fresh ordering is required */
unsigned int generation_id;
@@ -147,7 +147,7 @@ class symcache {
private:
using items_ptr_vec = std::vector<cache_item_ptr>;
/* Map indexed by symbol name: all symbols must have unique names, so this map holds ownership */
- robin_hood::unordered_flat_map<std::string_view, cache_item_ptr> items_by_symbol;
+ ankerl::unordered_dense::map<std::string_view, cache_item_ptr> items_by_symbol;
items_ptr_vec items_by_id;
/* Items sorted into some order */
pan> import ( "fmt" "net/http" "strings" org_model "code.gitea.io/gitea/models/organization" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/context" ) // UserAssignmentWeb returns a middleware to handle context-user assignment for web routes func UserAssignmentWeb() func(ctx *context.Context) { return func(ctx *context.Context) { userAssignment(ctx, func(status int, title string, obj interface{}) { err, ok := obj.(error) if !ok { err = fmt.Errorf("%s", obj) } if status == http.StatusNotFound { ctx.NotFound(title, err) } else { ctx.ServerError(title, err) } }) } } // UserAssignmentAPI returns a middleware to handle context-user assignment for api routes func UserAssignmentAPI() func(ctx *context.APIContext) { return func(ctx *context.APIContext) { userAssignment(ctx.Context, ctx.Error) } } func userAssignment(ctx *context.Context, errCb func(int, string, interface{})) { username := ctx.Params(":username") if ctx.IsSigned && ctx.Doer.LowerName == strings.ToLower(username) { ctx.ContextUser = ctx.Doer } else { var err error ctx.ContextUser, err = user_model.GetUserByName(ctx, username) if err != nil { if user_model.IsErrUserNotExist(err) { if redirectUserID, err := user_model.LookupUserRedirect(username); err == nil { context.RedirectToUser(ctx, username, redirectUserID) } else if user_model.IsErrUserRedirectNotExist(err) { errCb(http.StatusNotFound, "GetUserByName", err) } else { errCb(http.StatusInternalServerError, "LookupUserRedirect", err) } } else { errCb(http.StatusInternalServerError, "GetUserByName", err) } } else { if ctx.ContextUser.IsOrganization() { if ctx.Org == nil { ctx.Org = &context.Organization{} } ctx.Org.Organization = (*org_model.Organization)(ctx.ContextUser) ctx.Data["Org"] = ctx.Org.Organization } } } }