Class: VectorMCP::Transport::HttpStream::SessionManager::Session Private

Inherits:
Struct
  • Object
show all
Defined in:
lib/vector_mcp/transport/http_stream/session_manager.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

HTTP stream session data structure extending base session

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject

Returns the value of attribute context

Returns:

  • (Object)

    the current value of context



23
24
25
# File 'lib/vector_mcp/transport/http_stream/session_manager.rb', line 23

def context
  @context
end

#created_atObject

Returns the value of attribute created_at

Returns:

  • (Object)

    the current value of created_at



23
24
25
# File 'lib/vector_mcp/transport/http_stream/session_manager.rb', line 23

def created_at
  @created_at
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



23
24
25
# File 'lib/vector_mcp/transport/http_stream/session_manager.rb', line 23

def id
  @id
end

#last_accessed_atObject

Returns the value of attribute last_accessed_at

Returns:

  • (Object)

    the current value of last_accessed_at



23
24
25
# File 'lib/vector_mcp/transport/http_stream/session_manager.rb', line 23

def last_accessed_at
  @last_accessed_at
end

#metadataObject

Returns the value of attribute metadata

Returns:

  • (Object)

    the current value of metadata



23
24
25
# File 'lib/vector_mcp/transport/http_stream/session_manager.rb', line 23

def 
  @metadata
end

Instance Method Details

#add_streaming_connection(connection) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



52
53
54
55
# File 'lib/vector_mcp/transport/http_stream/session_manager.rb', line 52

def add_streaming_connection(connection)
  streaming_connections[connection.stream_id] = connection
  self.streaming_connection = connection
end

#ageObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



32
33
34
# File 'lib/vector_mcp/transport/http_stream/session_manager.rb', line 32

def age
  Time.now - created_at
end

#expired?(timeout) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


28
29
30
# File 'lib/vector_mcp/transport/http_stream/session_manager.rb', line 28

def expired?(timeout)
  Time.now - last_accessed_at > timeout
end

#remove_streaming_connection(connection = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



57
58
59
60
61
62
63
64
65
# File 'lib/vector_mcp/transport/http_stream/session_manager.rb', line 57

def remove_streaming_connection(connection = nil)
  if connection
    streaming_connections.delete(connection.stream_id)
    self.streaming_connection = streaming_connections.values.first if streaming_connection == connection
  else
    streaming_connections.clear
    self.streaming_connection = nil
  end
end

#streaming?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


36
37
38
# File 'lib/vector_mcp/transport/http_stream/session_manager.rb', line 36

def streaming?
  !streaming_connection.nil? || !streaming_connections.empty?
end

#streaming_connectionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



40
41
42
# File 'lib/vector_mcp/transport/http_stream/session_manager.rb', line 40

def streaming_connection
  [:streaming_connection]
end

#streaming_connection=(connection) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



44
45
46
# File 'lib/vector_mcp/transport/http_stream/session_manager.rb', line 44

def streaming_connection=(connection)
  [:streaming_connection] = connection
end

#streaming_connectionsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



48
49
50
# File 'lib/vector_mcp/transport/http_stream/session_manager.rb', line 48

def streaming_connections
  [:streaming_connections] ||= Concurrent::Hash.new
end

#touch!Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
# File 'lib/vector_mcp/transport/http_stream/session_manager.rb', line 24

def touch!
  self.last_accessed_at = Time.now
end