Code Monkey home page Code Monkey logo

Comments (4)

hsluoyz avatar hsluoyz commented on August 19, 2024 1

Hi @sadayuki-matsuno ,

I have added 3 optional functions in Xorm Adapter:

  1. AddPolicy()
  2. RemovePolicy()
  3. RemoveFilteredPolicy()

These functions will provide the auto-save functionality (aka save the policy line by line).

Please see details in: https://github.com/casbin/casbin/wiki/AutoSave

from xorm-adapter.

hsluoyz avatar hsluoyz commented on August 19, 2024

Hi @sadayuki-matsuno ,

This is also one thing that I got in my mind. I think we can add functions like AddPolicy() and RemovePolicy() to the adapter interface. But one issue is that there are still adapters that can't operate on line level. For example:

  • the protobuf adapter regards all policy rules as a string.
  • The same with KV store adapters, all policy rules are stored in one key.

So these adapters can't gain from the two calls, because they still need to save-all and load-all. If I add these two calls to the adapter interface, all other adapters have to support them too. One way to solve is using an empty implementation. So I think it's still doable.

What do you think about this way?

from xorm-adapter.

sadayuki-matsuno avatar sadayuki-matsuno commented on August 19, 2024

I understood. This is so complicated.
Using an empty implementation is good for me,
because KV stores also have more options to process one line at a time.

from xorm-adapter.

sadayuki-matsuno avatar sadayuki-matsuno commented on August 19, 2024

Thank you so much!

from xorm-adapter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.