GithubHelp home page GithubHelp logo

Mixing attributes about orleans HOT 10 CLOSED

dotnet avatar dotnet commented on May 14, 2024
Mixing attributes

from orleans.

Comments (10)

pherbel avatar pherbel commented on May 14, 2024

+1
This is more straightforward approach I like it

from orleans.

gabikliot avatar gabikliot commented on May 14, 2024

I like the straightforward approach. Maybe the naming for some categories will be a different.

from orleans.

yevhen avatar yevhen commented on May 14, 2024

@gabikliot sure, it was just an example

from orleans.

sergeybykov avatar sergeybykov commented on May 14, 2024

Should we catch such violations at compile/codegen time, just like we do for grain interface rules?

from orleans.

yevhen avatar yevhen commented on May 14, 2024

@sergeybykov hmmm, but isn't codegen only operates on interface project? And those attributes target grain class implementations ...

from orleans.

sergeybykov avatar sergeybykov commented on May 14, 2024

Codegen runs for grain implementations too, to generate state classes from state interfaces.

from orleans.

sergeybykov avatar sergeybykov commented on May 14, 2024

To clarify, I meant to say that in addition to structuring attributes into categories and having compiler enforce AllowMultiple=false, which I think is a great suggestion, we can also catch any violations that pass that filter at codegen time.

from orleans.

jkonecki avatar jkonecki commented on May 14, 2024

Another +1 for grouping attributes.

On Tue, 10 Feb 2015 22:10 Sergey Bykov [email protected] wrote:

Codegen runs for grain implementations too, to generate state classes from
state interfaces.


Reply to this email directly or view it on GitHub
#107 (comment).

from orleans.

yevhen avatar yevhen commented on May 14, 2024

@sergeybykov ah, sorry, forgot about that. I don't use built-in persistence :) Ye, it would be great, since grouping into category attributes with backed choice enums is not enough to catch invalid combinations across categories, such as StatelessWorker + Placement, or Reentrant + AlwaysInterleave

from orleans.

yevhen avatar yevhen commented on May 14, 2024

From my PoC, I've think that best way to group attributes is by having a configuration attribute for each type of activation. That will elegantly restrict what could be configured for each type of activation:

public enum Placement
{
    Auto,
    PreferLocal,
    DistributeEvenly
}

[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public class GrainAttribute : Attribute
{
    public readonly Placement Placement;

    public GrainAttribute(Placement placement = Placement.Auto)
    { 
        Placement = placement; 
    }
}

[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public class StatelessWorkerAttribute : Attribute
{
    // no additional configuration options at the moment
}

That only leaves us with mixing Reentrant and AlwaysInterleave but that not a big deal at all.

from orleans.

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.