Re: .Net ICacheEntryFilter

2018-03-21 Thread Alexey Popov
Hi,

Can you share a simple reproducer project for [InstanceResource] within
ICacheEntryFilter?

I can't find unit tests for that case in Apache Ignite source code.

> but the field _ignite is null and we have no access to cache to get it. 
That sounds like a bug that should be fixed.

Thanks,
Alexey



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: .Net ICacheEntryFilter

2018-03-13 Thread piccontroller
I see during filtration next callstack
 

If we open UnmanagedCallbacks we will see next:
 

I see the reference to _ignite instance are valid here but it is no passed
to func and no any wraps to embedd it to filter.

What correct way to get the reference to Ignite into Invoke function in
filter? 




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: .Net ICacheEntryFilter

2018-03-13 Thread piccontroller
1.Yeah. You allright. We do not save the objects directly. All objects have
ids and we save they ids and ids to refrenced objects. See below:

   public class CacheFieldProperty
{
public int Id { get; set; }
public int FormId { get; set; }//id of form object
...
other properties
..

  public override void WriteBinary(IBinaryWriter writer)
{
writer.WriteInt(nameof(Id), Id);

writer.WriteInt(nameof(FormId), FormId);
}


   public override void ReadBinary(IBinaryReader reader)
{
Id = reader.ReadInt(nameof(Id));

FormId = reader.ReadInt(nameof(FormId));
}

It is working ok.

2.
And now we are at server. The filter implemented ICacheEntryFilter

 public class CachePropertyNameFilter : ICacheEntryFilter
{
[InstanceResource]
private IIgnite _ignite;
.

we have only function

 public bool Invoke(ICacheEntry entry)
{

the entry.Value is ok
but we have only written properties Id, FormId.
But we NEEd to get the object Form from cache here for using it!!!
we need check some properties of Form object.

but the field _ignite is null and we have no access to cache to get it.
how to get Form object by FormId from Ignite here

I've checked this attribute at differ places. The result is null always.
}

Can you provide the working (or not working sample or link or something
else) of using cache from .Net filter?





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: .Net ICacheEntryFilter

2018-03-12 Thread Stanislav Lukyanov
Hi,

It seems to me that there are two questions in this post:
1) How to store cross-referencing data in an IgniteCache?
2) How to extract data from server based on some complex filter?

First, on the cross-references. To store a reference to another entity,
which is stored as a separate entry in the cache, one would usually store
that referenced value's key. So that neither TestItem nor TestList aggregate
the other but they have the keys and can obtain needed objects from the
cache.
To avoid querying the cache each time you need to access TestList from a
TestItem you could do that during the TestItem's construction (e.g. in
WriteBinary).

On executing filters on server: ScanQuery seems appropriate, and you usually
can declare a field with Instance​Resource​Attribute to have an instance of
Ignite injected into it. However, I'm not sure if ICacheEntryFilter is being
processed like that and can't check that right now. Could you please try
that?
Alternatively, you could call use ICompute.broadcast to get execute a
closure on all nodes and return a result.
To execute filter efficiently, make sure that your data is collocated and
that you're performing local queries from the filter, or you might end up
quering other nodes to filter local data and creating a lot of load this
way.

Thanks,
Stan



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/